加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.production.js 1.57 KB
一键复制 编辑 原始数据 按行查看 历史
Alexandr Subbotin 提交于 2017-05-19 14:55 . Turn on webpack tree shaking
const webpack = require('webpack')
const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const baseConfig = require('./webpack.config.base')
const OptimizeJsPlugin = require('optimize-js-plugin')
const Visualizer = require('webpack-visualizer-plugin')
const config = {
...baseConfig,
devtool: 'source-map',
entry: {
main: './app/main/main',
background: './app/background/background'
},
output: {
...baseConfig.output,
path: path.join(__dirname, 'app/dist'),
publicPath: '../dist/'
},
module: {
...baseConfig.module,
rules: [
...baseConfig.module.rules,
{
test: /global\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
})
},
{
test: /^((?!global).)*\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1,
localIdentName: '[name]__[local]___[hash:base64:5]'
}
},
'postcss-loader'
]
})
}
]
},
plugins: [
...baseConfig.plugins,
new ExtractTextPlugin({
filename: '[name].css',
allChunks: true,
ignoreOrder: true
}),
new OptimizeJsPlugin({
sourceMap: false
})
],
target: 'electron-renderer'
}
if (process.env.ANALYZE) {
config.plugins.push(new Visualizer())
}
module.exports = config
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化