build using HtmlWebpackPlugin succeeds
pogilvie: (master):~/Projects/learning/wp-> npm run build
> [email protected] build /Users/pogilvie/Projects/Learning/wp
> webpack
/Users/pogilvie/Projects/Learning/wp/node_modules/webpack-cli/bin/cli.js:93
throw err;
^
ReferenceError: HtmlWebpackPlugin is not defined
at Object.<anonymous> (/Users/pogilvie/Projects/Learning/wp/w
Tell us which operating system you are using, as well as which versions of Node.js, npm, webpack, and html-webpack-plugin. Run the following to get it quickly:
Node.js v10.13.0
darwin 19.5.0
[email protected]
npm ls html-webpack-plugin
[email protected]
module.exports = {
entry: {
app: './src/index.js',
print: './src/print.js'
},
plugins: [
new HtmlWebpackPlugin()
],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
},
};
Copy your template file if it is part of this issue:
<!doctype html>
<html>
<head>
<title>Output Management</title>
<script src="./print.bundle.js"></script>
</head>
<body>
<script src="./app.bundle.js"></script>
</body>
</html>
I'm following the webpack tutorial and hit this.
https://webpack.js.org/guides/output-management/
I'm not sure how to debug this. thanks!
Did you require the plugin in the config file?
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
...,
plugins: [
new HtmlWebpackPlugin(),
...,
],
...,
};
Sigh thank you for taking the time to help a newbie out! That was it.
Most helpful comment
Did you require the plugin in the config file?