webpack: DedupePlugin fails: No template for dependency: TemplateArgumentDependency

Hi folks,

Great job with Webpack, this framework is really helping my project to succeed. I’m using version 1.8.11 through gulp-webpack and after I’ve added react-intl in my project this problem started to happen:

Error: No template for dependency: TemplateArgumentDependency
    at doDep (/Users/alansouza/project-workspace/project/node_modules/gulp-webpack/node_modules/webpack/lib/NormalModule.js:116:23)
    at Array.forEach (native)
    at doBlock (/Users/alansouza/project-workspace/project/node_modules/gulp-webpack/node_modules/webpack/lib/NormalModule.js:125:22)
    at DependenciesBlock.NormalModule.source (/Users/alansouza/project-workspace/project/node_modules/gulp-webpack/node_modules/webpack/lib/NormalModule.js:159:2)
    at Tapable.ModuleTemplate.render (/Users/alansouza/project-workspace/project/node_modules/gulp-webpack/node_modules/webpack/lib/ModuleTemplate.js:14:28)
    at Tapable.Template.renderChunkModules (/Users/alansouza/project-workspace/project/node_modules/gulp-webpack/node_modules/webpack/lib/Template.js:80:31)
    at Tapable.<anonymous> (/Users/alansouza/project-workspace/project/node_modules/gulp-webpack/node_modules/webpack/lib/MainTemplate.js:28:22)
    at Tapable.applyPlugins [as applyPluginsWaterfall] (/Users/alansouza/project-workspace/project/node_modules/gulp-webpack/node_modules/webpack/node_modules/tapable/lib/Tapable.js:37:47)
    at Tapable.MainTemplate.render (/Users/alansouza/project-workspace/project/node_modules/gulp-webpack/node_modules/webpack/lib/MainTemplate.js:111:20)
    at Tapable.createChunkAssets (/Users/alansouza/project-workspace/project/node_modules/gulp-webpack/node_modules/webpack/lib/Compilation.js:784:32)

After some investigation and checking out some suggestions in the webpack Gitter chat, I decided to remove the Dedupe Plugin and then everything works again, but my bundle size has increased significantly.

Any ideas on how to make the DedupePlugin work again? If I get any pointers I could try to solve the issue myself. Any help here is much appreciated.

Alan

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 4
  • Comments: 24 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks!

For anyone encountering this in the future, the comment referenced above says:

Error: No template for dependency: TemplateArgumentDependency happens when you have multiple webpack copies installed and used the DedupePlugin from a different copy.

I was using a serverless-webpack-plugin which had it’s own webpack dependency it was using to bundle files. However, I had manually installed and required webpack in my project’s webpack config as well (like you normally would with webpack). Consequently, when I removed my explicitly installed version of webpack with npm rm --save-dev webpack, the plugin was able to require it’s own scoped webpack dependency instead which worked.

I’ll alert the serverless-webpack-plugin repo to this issue to figure out how to make it easier to use in the future.

rm -rf node_modules && npm i solved the issue. Please ignore my previous message.

I’m closing this as there’s no DedupePlugin in webpack 2 anymore.

@tribou Thanks, I will look at that too.

But I guess my problem is a bit weirder - since exactly the same project copied to another machine (including node_modules) works fine on one machine but has this error on the other machine.

Having a similar issue
Running webpack works, however, webpack-dev-server breaks with the “No template…” error, and removing the dedupe plugin fixes it