mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
34 lines
758 B
JavaScript
34 lines
758 B
JavaScript
const BabiliPlugin = require("babili-webpack-plugin")
|
|
const webpack = require("webpack")
|
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
|
const { ANALYZE } = process.env
|
|
|
|
module.exports = {
|
|
webpack: (config, { dev }) => {
|
|
config.plugins = config.plugins.filter(plugin => plugin.constructor.name !== 'UglifyJsPlugin');
|
|
|
|
config.node = {
|
|
fs: 'empty'
|
|
}
|
|
|
|
config.plugins.push(
|
|
new webpack.DefinePlugin({IN_BROWSER: true})
|
|
)
|
|
|
|
if (!dev) {
|
|
config.plugins.push(
|
|
new BabiliPlugin()
|
|
)
|
|
}
|
|
|
|
if (ANALYZE) {
|
|
config.plugins.push(new BundleAnalyzerPlugin({
|
|
analyzerMode: 'server',
|
|
analyzerPort: 8888,
|
|
openAnalyzer: true
|
|
}))
|
|
}
|
|
|
|
return config;
|
|
}
|
|
}; |