Update strategy caching bundle front js files with webpack

- Add HtmlWebpackPlugin to use template index html
This commit is contained in:
Gregoire Parant 2020-06-01 11:53:12 +02:00
parent f2d7a9a732
commit 244f87196e
5 changed files with 308 additions and 5 deletions

View file

@ -1,5 +1,6 @@
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/index.ts',
@ -28,11 +29,16 @@ module.exports = {
extensions: [ '.tsx', '.ts', '.js' ],
},
output: {
filename: 'bundle.js',
filename: '[name].[contenthash].js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin(
{
template: './dist/index.html'
}
),
new webpack.ProvidePlugin({
Phaser: 'phaser'
}),