Skip to content

ngtools/webpack: components of lazy-loaded routes are not rebuilt in watch mode when using extensions: ['.js', '.ts'] #8508

@ztan

Description

@ztan

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

"@angular/animations": "^5.0.1",
"@angular/common": "^5.0.1",
"@angular/compiler": "^5.0.1",
"@angular/core": "^5.0.1",
"@angular/forms": "^5.0.1",
"@angular/platform-browser": "^5.0.1",
"@angular/platform-browser-dynamic": "^5.0.1",
"@angular/router": "^5.0.1",
"rxjs": "5.5.2",
"zone.js": "^0.8.18"
"@angular/compiler-cli": "^5.0.1",
"@ngtools/webpack": "^1.8.0",
"typescript": "^2.6.1"

Repro steps.

Here is a part of the config we used for our development builds. It worked all fine in the initial compilation. However when in watch mode we changed a component routed in a lazy-loaded module, webpack didn't rebuild the files.

module: {
	rules: [
		{
			test: /\.ts$/,
			exclude: [/node_modules/, /\.spec\.(js|ts)$/],
			use: ['@ngtools/webpack']
		}
	]
},
plugins: [
	new AngularCompilerPlugin({
		tsConfigPath: path.join(process.cwd(), 'tsconfig.json'),
		entryModule: path.join(process.cwd(), 'src/app/index#AppModule'),
		mainPath: path.join(process.cwd(), 'src/index'),
		compilerOptions: {
			sourceMap: true
		}
	}),
]

Before Angular 5 upgrade, we had ['ng-router-loader', 'ts-loader', 'angular2-template-loader'] as the loader chain. With the Angular team now recommend AOT for dev builds as well, we figured we should use ngtool/webpack for both prod and dev. This bug is preventing us from doing so

The log given by the failure.

No error from the logs

Desired functionality.

Webpack should recompile the changes from a component of lazy-loaded routes, when the routes are processed by ngtools/webpack.

Mention any other details that might be useful.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions