36 lines
718 B
JavaScript
36 lines
718 B
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
module.exports = {
|
|
mode: 'development',
|
|
entry: './src/index.js',
|
|
devtool: 'inline-source-map',
|
|
devServer: {
|
|
contentBase: './dist',
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
title: 'Caching',
|
|
})
|
|
],
|
|
output: {
|
|
filename: '[name].[contenthash].js',
|
|
path: path.resolve(__dirname, 'dist'),
|
|
clean: true,
|
|
publicPath: '/',
|
|
},
|
|
optimization: {
|
|
moduleIds: 'deterministic',
|
|
runtimeChunk: 'single',
|
|
splitChunks: {
|
|
cacheGroups: {
|
|
vendor: {
|
|
test: /[\\/]node_modules[\\/]/,
|
|
name: 'vendors',
|
|
chunks: 'all',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|