Skip to content

Instantly share code, notes, and snippets.

@WesleySmits
Created October 10, 2021 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WesleySmits/0e60ed33630d040e07f1aec5f9956924 to your computer and use it in GitHub Desktop.
Save WesleySmits/0e60ed33630d040e07f1aec5f9956924 to your computer and use it in GitHub Desktop.
TS Starter: Add HTMLWebpackPlugin to webpack.config.js
const path = require('path');
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
context: path.join(__dirname, 'app'),
entry: [
'./js/app.js',
],
output: {
path: path.join(__dirname, 'public'),
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
'babel-loader',
],
},
],
},
+ plugins: [new HtmlWebpackPlugin({
+ 'template': path.resolve(__dirname, 'app/index.html'),
+ 'inject': 'body'
+ })],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment