Created
October 10, 2021 09:07
-
-
Save WesleySmits/0e60ed33630d040e07f1aec5f9956924 to your computer and use it in GitHub Desktop.
TS Starter: Add HTMLWebpackPlugin to webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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