More progress in webpack guides

This commit is contained in:
2021-04-08 09:05:11 -05:00
parent cf8885ed14
commit dcf99e5409
6 changed files with 3816 additions and 14 deletions

View File

@@ -1,9 +1,35 @@
const path = require("path");
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: "./src/index.js",
mode: 'development',
entry: './src/index.js',
devtool: 'inline-source-map',
devServer: {
contentBase: './dist',
},
plugins: [
new HtmlWebpackPlugin({
title: 'Caching',
})
],
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
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',
},
},
},
},
};