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
- Fix issue with global React in dist - Webpack: Export React as external, not Victory - Upgrade Webpack to 1.12.9 for a fix to https://github.com/webpack/webpack/issues/1082 — committed to FormidableLabs/builder-victory-component by deleted user 9 years ago
- Upgrade to webpack 1.13.2 This matches the webapck version in formidable-playbook and works around https://github.com/webpack/webpack/issues/1082 — committed to FormidableLabs/builder-docs-archetype by deleted user 8 years ago
- workaround webpack issue https://github.com/webpack/webpack/issues/1082 — committed to toruta39/ReactNativeTodoMVC by toruta39 8 years ago
Thanks!
For anyone encountering this in the future, the comment referenced above says:
I was using a
serverless-webpack-plugin
which had it’s ownwebpack
dependency it was using to bundle files. However, I had manually installed andrequire
d 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 withnpm rm --save-dev webpack
, the plugin was able torequire
it’s own scopedwebpack
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