1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | const path = require( 'path' ); const HtmlWebpackPlugin = require( 'html-webpack-plugin' ); module.exports = { entry: './src/index.js' , output: { filename: '[name].[contenthash].js' , path: path.resolve(__dirname, 'dist' ) }, plugins: [ new HtmlWebpackPlugin({ template: './src/index.html' }) ] }; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | const path = require( 'path' ); module.exports = { // ... output: { filename: '[name].[contenthash].js' , path: path.resolve(__dirname, 'dist' ), publicPath: '/' , }, // ... optimization: { runtimeChunk: 'single' , moduleIds: 'hashed' , splitChunks: { cacheGroups: { vendor: { test: /[\\/]node_modules[\\/]/, name: 'vendors' , chunks: 'all' } } } } }; |
本文为翻滚的胖子原创文章,转载无需和我联系,但请注明来自猿教程iskeys.com