I'm getting this error when I use the commonjs import for css files in template.js which is used in HtmlWebpackPlugin:
ERROR in Error: Child compilation failed:
No template for dependency: CssDependency
CodeGenerationError: No template for dependency: CssDependency
I don't see any problems when I use the ES6 import. I also don't see any problems when I use the commonjs import for .js files. I believe the problem somewhere in MiniCssExtractPlugin.
Actual Behavior
No template for dependency: CssDependency when use require('*.css') in template.js for HtmlWebpackPlugin
Bug report
I'm getting this error when I use the commonjs import for css files in template.js which is used in HtmlWebpackPlugin:
I don't see any problems when I use the ES6 import. I also don't see any problems when I use the commonjs import for .js files. I believe the problem somewhere in MiniCssExtractPlugin.
Actual Behavior
No template for dependency: CssDependency
when userequire('*.css')
intemplate.js
forHtmlWebpackPlugin
Expected Behavior
Works as ES6
How Do We Reproduce?
template.js
webpack
Please paste the results of
npx webpack-cli info
here, and mention other relevant information