Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x)
- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
$ node --version
v8.9.0
$ npm --version
6.0.1
Angular CLI: 6.1.1
Node: 8.9.0
OS: win32 x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.7.1
@angular-devkit/build-angular 0.7.1
@angular-devkit/build-optimizer 0.7.1
@angular-devkit/build-webpack 0.7.1
@angular-devkit/core 0.7.1
@angular-devkit/schematics 0.7.1
@angular/cli 6.1.1
@ngtools/webpack 6.1.1
@schematics/angular 0.7.1
@schematics/update 0.7.1
rxjs 6.2.2
typescript 2.7.2
webpack 4.9.2
Repro steps
- ng new lazyscss --style scss
- Adjust angular.json to lazy load styles.sccs (
"styles": [{"input": "src/styles.scss", "lazy":true} ],)
- ng build --prod
- The build contains the hashed version of styles.scss
The log given by the failure
None.
Desired functionality
Based on the pull request (#11491) the hashing should be disabled for lazy loaded styles. Therefore a styles.css is expected in the dist folder (instead a styles.<hash>.css is included).
This should have been fixed with issue #11235 / pull request #11491.
Mention any other details that might be useful
It seems that the problem is caused by passing the name (e.g. "styles") in styles.ts#getStylesConfig instead of the ID (which isn't even present at the time):
|
chunkIds.push(style.bundleName); |
|
extraPlugins.push(new RemoveHashPlugin({ chunkIds, hashFormat})); |
Later, in the RemoveHashPlugin#apply the name is then compared to the actual ID:
|
const chunkId = data.chunk && data.chunk.id; |
|
if (chunkId && this.options.chunkIds.includes(chunkId)) { |
Changing remove-hash-plugin.ts#L29 to use data.chunk.name instead of data.chunk.id resolved the issue in our tests.
Bug Report or Feature Request (mark with an
x)Command (mark with an
x)Versions
$ node --version
v8.9.0
$ npm --version
6.0.1
Angular CLI: 6.1.1
Node: 8.9.0
OS: win32 x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.7.1
@angular-devkit/build-angular 0.7.1
@angular-devkit/build-optimizer 0.7.1
@angular-devkit/build-webpack 0.7.1
@angular-devkit/core 0.7.1
@angular-devkit/schematics 0.7.1
@angular/cli 6.1.1
@ngtools/webpack 6.1.1
@schematics/angular 0.7.1
@schematics/update 0.7.1
rxjs 6.2.2
typescript 2.7.2
webpack 4.9.2
Repro steps
"styles": [{"input": "src/styles.scss", "lazy":true} ],)The log given by the failure
None.
Desired functionality
Based on the pull request (#11491) the hashing should be disabled for lazy loaded styles. Therefore a
styles.cssis expected in the dist folder (instead astyles.<hash>.cssis included).This should have been fixed with issue #11235 / pull request #11491.
Mention any other details that might be useful
It seems that the problem is caused by passing the name (e.g. "styles") in styles.ts#getStylesConfig instead of the ID (which isn't even present at the time):
angular-cli/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/styles.ts
Line 191 in 3529096
angular-cli/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/styles.ts
Line 200 in 3529096
Later, in the RemoveHashPlugin#apply the name is then compared to the actual ID:
angular-cli/packages/angular_devkit/build_angular/src/angular-cli-files/plugins/remove-hash-plugin.ts
Line 29 in 3529096
angular-cli/packages/angular_devkit/build_angular/src/angular-cli-files/plugins/remove-hash-plugin.ts
Line 31 in 3529096
Changing remove-hash-plugin.ts#L29 to use
data.chunk.nameinstead ofdata.chunk.idresolved the issue in our tests.