18 Star 141 Fork 52

hualun/fighter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
hualun 提交于 2018-05-08 10:33 . beta
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
module.exports = {
mode: 'development',
entry: './src/js/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
use: [{
loader: 'babel-loader',
options: {
presets: ['env']
}
}],
exclude: '/node_modules/'
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: [{
loader: 'css-loader',
options: {
minimize: true
}
}]
})
},
{
test: /\.(png|jpg|gif|jpeg)$/,
use: [{
loader: 'url-loader',
options: {
limit: 20480,
outputPath: 'img'
}
}]
}
]
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src', 'index.html'),
filename: 'index.html',
hash: true, // 防止缓存
minify: {
removeAttributeQuotes: true // 压缩
}
}),
new CopyWebpackPlugin([{
from: './src/img',
to: '../dist/img'
}]),
new CopyWebpackPlugin([{
from: './src/sound',
to: '../dist/sound'
}]),
new ExtractTextPlugin('style.css'),
new UglifyJsPlugin()
]
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/hualun/fighter.git
git@gitee.com:hualun/fighter.git
hualun
fighter
fighter
master

搜索帮助