1 Star 0 Fork 0

清风/blog_web

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.prod.js 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
小憩清风 提交于 2019-12-03 15:10 . first commit
/**
* Created by magedu on 2017/4/20.
*/
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'source-map',
entry: {
'app': [
'./src/index'
]
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name]-[hash:8].js',
publicPath: '/assets/'
},
resolve: {
extensions: ['.js']
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/, // 不编译第三方包
use: [
{ loader: 'react-hot-loader/webpack' },
{ loader: 'babel-loader' }
]
},
{
test: /\.less$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{ loader: "less-loader" }
]
}
]
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(true),
new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') } }),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
sourceMap: true
}),
new HtmlWebpackPlugin({
template: 'src/index.html',
inject: true
})
]
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xqqf/fontend.git
git@gitee.com:xqqf/fontend.git
xqqf
fontend
blog_web
master

搜索帮助