ng serve --prod Cannot use [chunkhash] or [contenthash]
See original GitHub issueVersions
Angular CLI: 6.0.0-rc.5
Node: 8.9.1
OS: win32 x64
Angular: 6.0.0-rc.5
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.5.7
@angular-devkit/build-angular 0.5.7
@angular-devkit/build-optimizer 0.5.7
@angular-devkit/core 0.5.7
@angular-devkit/schematics 0.5.7
@ngtools/json-schema 1.2.0
@ngtools/webpack 6.0.0-rc.5
@schematics/angular 0.5.7
@schematics/update 0.5.7
rxjs 6.0.0-uncanny-rc.7
typescript 2.7.2
webpack 4.5.0
Repro steps
- Set “hmr”: true under serve options
- ng serve --prod
Observed behavior
****************************************************************************************
Date: 2018-04-20T11:18:32.210Z
Hash: 479da56e19191460642b
Time: 25039ms
chunk {0} admin-admin-module-ngfactory.2293166986b2fdeaaf9e.js (admin-admin-module-ngfactory) 811 bytes [rendered]
chunk {1} (runtime) [entry] [rendered]
chunk {2} styles.34c57ab7888ec1573f9c.css (styles) 0 bytes [initial] [rendered]
chunk {3} polyfills.fbe8aa029ddbd67561f0.js (polyfills) 59.4 kB [initial] [rendered]
chunk {4} main.272e4975a98129fc0e4c.js (main) 382 kB [initial] [rendered]
ERROR in chunk runtime [entry]
[name].[chunkhash:20].js
Cannot use [chunkhash] or [contenthash] for chunk in '[name].[chunkhash:20].js' (use [hash] instead)
Desired behavior
No error
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Cannot use [chunkhash] or [contenthash] for chunk in '[name ...
Very useful because I forgot to remove --hmr when trying a production mode build on local development server ( ng serve --prod --hmr...
Read more >ERROR in chunk application [entry] js/[name]-[contenthash].js ...
I have always this error in red !!! ERROR in chunk application [entry] js/[name]-[contenthash].js Cannot use [chunkhash] or [contenthash] for ...
Read more >Angular CLI v11.0.3 Release - GitClear
ng serve --prod Cannot use [chunkhash] or [contenthash] · #10411 · angular-cli 11's scss source map only shows the file listed in angular....
Read more >How to configure Webpack 4 with Angular 7: a complete guide
[contenthash] returns a hash generated based on content. It's preferable to use particularly hash and chunkhash only for production as hashing ...
Read more >webpack/webpack - Gitter
Cannot use import statement outside a module import Swiper from 'swiper'; ... stuff will need to end up in a location that the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, this is still reproducible with
7.1.2
, which is sort of indented since using thechunkhash
would break HMR.There are two possible fixes for this.
hmr
withoutputHashing
we display an appropiate error that states that these 2 options cannot be used together.contenthash
andchunkhash
tohash
. in https://github.com/angular/angular-cli/blob/2326850374cd393a825e339beb5846afcff87f8a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/utils.ts#L32-L33I was able to get around this by setting “outputHashing”: “none” in my angular.json file. I’m not entirely clear on how that works anyway but it allowed me to keep working until this gets resolved.