123456789101112131415161718192021222324252627282930313233 |
- const { resolve } = require("path");
- //html资源处理
- const HtmlWebpackPlugin = require('html-webpack-plugin')
- //设置node环境变量 postcss-loader会根据它读取package.js里的browserslist配置
- process.env.NODE_ENV = 'development'
- /**
- *
- */
- module.exports = {
- entry:'./src/js/index.js',
- output: {
- // name取文件名
- filename: 'js/[name].[contenthash:10].js',
- path: resolve(__dirname, 'build')
- },
- plugins:[
- new HtmlWebpackPlugin({
- template: './src/index.html',
- minify:{
- collapseWhitespace:true,
- removeComments:true
- }
- })
- ],
- optimization:{
- splitChunks:{
- chunks:'all'
- }
- },
- mode:'production'
- }
|