Module not found: Error: Cannot resolve module 'html'
Olgagr opened this issue · 0 comments
Olgagr commented
Current behaviour 💣
I'm trying to load a custom template in my main template file. I checked the docs: https://github.com/jantimon/html-webpack-plugin/blob/v2.26.0/examples/custom-template/template.html
In my main template file I do (this is .ejs file):
<%= require('html!./test.html') %>
Then I get an error:
ERROR in ./~/html-webpack-plugin/lib/loader.js!./lib/template.ejs
Module not found: Error: Cannot resolve module 'html' in /Users/xxx/Documents/projects/project/lib
@ ./~/html-webpack-plugin/lib/loader.js!./lib/template.ejs 9:10-37
Expected behaviour ☀️
I can load a custom template with required
Environment 🖥
My webpack configuration:
new HtmlWebpackPlugin({
title: clientConfig.html_title,
banner: banner,
publicPath: (debug ? `http://${ipToUse}:8080/` : fullDeployPath),
chunks: ['home'],
is_debug: debug,
template: path.join(__dirname, 'lib', 'template.ejs'),
inject: 'body',
filename: 'index.html',
homeRedirectLink: process.env.NODE_ENV === 'production' && clientAppConfig.homeRedirectionLink,
hasConsentScript: clientAppConfig.hasConsentScript,
}),
node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
Node.js v10.22.0
darwin 20.3.0
npm --version
6.14.6
npm ls webpack
1.14.0
npm ls html-webpack-plugin
2.26.0