iemotion
Version:
评论时快速找到表情。
87 lines (86 loc) • 2.07 kB
JavaScript
/**
* @description:
* @author: 小康
* @url: https://xiaokang.me
* @Date: 2021-01-12 16:06:06
* @LastEditTime: 2021-01-12 16:06:07
* @LastEditors: 小康
*/
const { resolve } = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = {
entry: './src/js/index.js',
output: {
filename: '[chunkhash:8].js',
path: resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
}
]
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: resolve(__dirname, 'src/index.html'), // 指定模板文件
filename: 'index.html', //设置内存中的文件名
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true
}
})
// new CopyWebpackPlugin({
// patterns: [
// {
// from: resolve(__dirname, 'src/emtionData')
// // to: resolve(__dirname, 'dist/data')
// }
// ]
// })
],
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: 4,
terserOptions: {
ecma: 5,
toplevel: true,
ie8: true,
safari10: true,
compress: {
drop_console: true
},
format: {
comments: false
}
}
})
]
},
mode: process.env.NODE_ENV,
devServer: {
// 构建后的路径
contentBase: resolve(__dirname, 'dist'),
// 启动gzip压缩
compress: true,
// 端口号
port: 3000,
hot: true
}
}