Skip to content

Commit a4ac1ef

Browse files
committed
Do not add the lazy routes to the entry points.
1 parent aa132b1 commit a4ac1ef

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

addon/ng2/models/webpack-build-common.ts

+6-27
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,22 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
1313
let outputPath: string = path.resolve(projectRoot, outputDir);
1414
const lazyModules = findLazyModules(path.resolve(projectRoot, sourceDir));
1515

16-
const entries = Object.assign({
17-
main: [path.join(sourceRoot, 'main.ts')],
18-
polyfills: path.join(sourceRoot, 'polyfills.ts')
19-
}, lazyModules);
20-
21-
2216
return {
2317
devtool: 'source-map',
2418
resolve: {
2519
extensions: ['', '.ts', '.js'],
2620
root: path.resolve(projectRoot, `./${sourceDir}`)
2721
},
2822
context: path.resolve(__dirname, './'),
29-
entry: entries,
23+
entry: {
24+
main: [path.join(sourceRoot, 'main.ts')],
25+
polyfills: path.join(sourceRoot, 'polyfills.ts')
26+
},
3027
output: {
3128
path: outputPath,
3229
filename: '[name].bundle.js'
3330
},
3431
module: {
35-
preLoaders: [
36-
{
37-
test: /\.js$/,
38-
loader: 'source-map-loader',
39-
exclude: [
40-
path.resolve(projectRoot, 'node_modules/rxjs'),
41-
path.resolve(projectRoot, 'node_modules/@angular'),
42-
]
43-
},
44-
{
45-
test: /(systemjs_component_resolver|system_js_ng_module_factory_loader)\.js$/,
46-
loader: 'string-replace-loader',
47-
query: {
48-
search: '(lang_1(.*[\\n\\r]+\\s*\\.|\\.))?(global(.*[\\n\\r]+\\s*\\.|\\.))?(System|SystemJS)(.*[\\n\\r]+\\s*\\.|\\.)import\\(',
49-
replace: 'System.import("" + ',
50-
flags: 'g'
51-
}
52-
},
53-
],
5432
loaders: [
5533
{
5634
test: /\.ts$/,
@@ -77,13 +55,14 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
7755
]
7856
},
7957
plugins: [
58+
new webpack.ContextReplacementPlugin(/.*/, sourceRoot, lazyModules),
8059
new atl.ForkCheckerPlugin(),
8160
new HtmlWebpackPlugin({
8261
template: path.resolve(projectRoot, `./${sourceDir}/index.html`),
8362
chunksSortMode: 'dependency'
8463
}),
8564
new webpack.optimize.CommonsChunkPlugin({
86-
name: 'polyfills'
65+
name: ['polyfills']
8766
}),
8867
new webpack.optimize.CommonsChunkPlugin({
8968
minChunks: Infinity,

0 commit comments

Comments
 (0)