angular-cli: Error in chunk main - HarmonyImportDependency

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Windows 10
  2. Versions. Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version and paste the result here: angular-cli: 1.0.0-beta.11-webpack node: 4.3.0 os: win32 x64
  3. Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc. Create with cli (systemjs). Upgraded to webpack
  4. The log given by the failure. Normally this include a stack trace and some more information. ERROR in chunk main [initial] [name].[chunkhash].bundle.js Template cannot be applied as TemplateArgument: HarmonyImportDependency
  5. Mention any other details that might be useful. Only happens with ng serve/build -prod. Dev works fine.

Thanks! We’ll be in touch soon.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 5
  • Comments: 19 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I have exact the same issue. When will the fix be available? $ ng version angular-cli: 1.0.0-beta.11-webpack.8 node: 5.7.1 os: darwin x64

I still get this bug on the most recent master, #1937 didn’t fix it for me @Brocco

angular-cli: ba668a8 node: Node v6.5.0 OS: Win10 x64

Yup I’m working on this, this is a problem with HarmonyDependencies and the DedupePlugin({})

@filipesilva We need to remove DedupePlugin({}) for now from webpack-build-production.ts in the meantime to fix this.

The fix for this issue on webpack’s side is pretty complex (because of DedupePlugin)

The optimizations are very very minimal, and as long as users don’t make the mistake of importing dupes of dependencies, it shouldn’t be a problem. npm dedupe can help too (for the user).

I have the same issue when I run ng build -prod

chunk {0} (main) 2.48 MB {1} [initial] chunk {1} inline.js (inline) 0 bytes [entry] [rendered] ERROR in chunk main [initial] [name].[chunkhash].bundle.js Template cannot be applied as TemplateArgument: HarmonyImportDependency Child html-webpack-plugin for “index.html”: Asset Size Chunks Chunk Names index.html 5.05 kB 0
chunk {0} index.html 2.58 kB [entry] [rendered]

Closed via #1937

@andyrue it’s a webpack issue, think @thelarkinn is on it. 😃