Skip to content

Commit ecb9b93

Browse files
committed
Do not add the lazy routes to the entry points.
1 parent 789f4ef commit ecb9b93

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ import {findLazyModules} from './find-lazy-modules';
99

1010
export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
1111
const sourceRoot = path.resolve(projectRoot, `./${sourceDir}`);
12-
1312
const lazyModules = findLazyModules(path.resolve(projectRoot, sourceDir));
14-
const entries = Object.assign({
15-
main: [path.join(sourceRoot, 'main.ts')],
16-
polyfills: path.join(sourceRoot, 'polyfills.ts')
17-
}, lazyModules);
18-
1913

2014
return {
2115
devtool: 'source-map',
@@ -24,7 +18,10 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
2418
root: path.resolve(projectRoot, `./${sourceDir}`)
2519
},
2620
context: path.resolve(__dirname, './'),
27-
entry: entries,
21+
entry: {
22+
main: [path.join(sourceRoot, 'main.ts')],
23+
polyfills: path.join(sourceRoot, 'polyfills.ts')
24+
},
2825
output: {
2926
path: path.resolve(projectRoot, './dist'),
3027
filename: '[name].bundle.js'
@@ -75,6 +72,7 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
7572
]
7673
},
7774
plugins: [
75+
new webpack.ContextReplacementPlugin(/.*/, sourceRoot, lazyModules),
7876
new atl.ForkCheckerPlugin(),
7977
new HtmlWebpackPlugin({
8078
template: path.resolve(projectRoot, `./${sourceDir}/index.html`),

0 commit comments

Comments
 (0)