forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(@angular/cli): use shared configs for ng test
Fix angular#3605 Fix angular#4850
- Loading branch information
1 parent
cd1aa18
commit 792e980
Showing
19 changed files
with
249 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import * as webpack from 'webpack'; | ||
import * as path from 'path'; | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
import { packageChunkSort } from '../../utilities/package-chunk-sort'; | ||
import { BaseHrefWebpackPlugin } from '../../lib/base-href-webpack'; | ||
import { extraEntryParser, lazyChunksFilter } from './utils'; | ||
import { WebpackConfigOptions } from '../webpack-config'; | ||
|
||
|
||
export function getBrowserConfig(wco: WebpackConfigOptions) { | ||
const { projectRoot, buildOptions, appConfig } = wco; | ||
|
||
const appRoot = path.resolve(projectRoot, appConfig.root); | ||
const nodeModules = path.resolve(projectRoot, 'node_modules'); | ||
|
||
let extraPlugins: any[] = []; | ||
|
||
// figure out which are the lazy loaded entry points | ||
const lazyChunks = lazyChunksFilter([ | ||
...extraEntryParser(appConfig.scripts, appRoot, 'scripts'), | ||
...extraEntryParser(appConfig.styles, appRoot, 'styles') | ||
]); | ||
|
||
if (buildOptions.vendorChunk) { | ||
extraPlugins.push(new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
chunks: ['main'], | ||
minChunks: (module: any) => module.resource && module.resource.startsWith(nodeModules) | ||
})); | ||
} | ||
|
||
return { | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
template: path.resolve(appRoot, appConfig.index), | ||
filename: path.resolve(buildOptions.outputPath, appConfig.index), | ||
chunksSortMode: packageChunkSort(appConfig), | ||
excludeChunks: lazyChunks, | ||
xhtml: true | ||
}), | ||
new BaseHrefWebpackPlugin({ | ||
baseHref: buildOptions.baseHref | ||
}), | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
minChunks: Infinity, | ||
name: 'inline' | ||
}) | ||
].concat(extraPlugins) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export * from './browser'; | ||
export * from './common'; | ||
export * from './development'; | ||
export * from './production'; | ||
export * from './styles'; | ||
export * from './test'; | ||
export * from './typescript'; | ||
export * from './utils'; | ||
export * from './xi18n'; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.