html-webpack-plugin: Cannot resolve module html-webpack-plugin/lib/loader.js after upgrade to 2.25.0
Hi, after upgrade to version 2.25.0 (I have the same problem with version 2.26.0) I got an error:
ERROR in EntryModuleNotFoundError: Entry module not found: Error: Cannot resolve
module 'html-webpack-plugin/lib/loader.js'
I wasn’t able to find, what change caused this problem.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 19 (4 by maintainers)
I had a similar issue mentioned here but with the plugin not being able to find
lodash.js. You can expand the error by using the--display-error-detailsflag on webpack - and I could see that it was complaining that it couldn’t findlodash.js.js. Anyway I eventually figured out what had happened.It was being caused by this config item:
In my
webpack 1.xconfig theresolve.extensionsconfig item has an empty string as the first property, which means it will find e.g. a filename of lodash.js in the order oflodash.js,lodash.js.js,lodash.jsxetc.In
webpack 2.xthe empty string isn’t allowed, meaning the plugin has to give it a filename oflodashonly and it will find it in the order oflodash.js,lodash.jsxetcI’m not sure if this helps here but it solved my problem (in this case I was actually downgrading from webpack 2 to 1)
I just discovered the following (inside webpack.config.js):
Does not work:
resolveLoader: { root: paths.ownNodeModules, moduleTemplates: ['*-loader'] }Works:
resolveLoader: { root: paths.ownNodeModules }Again, I had copied this from create-react-app and have no idea why moduleTemplates is being modified from the default.