45 lines
973 B
JavaScript
45 lines
973 B
JavaScript
const {
|
|
override,
|
|
addLessLoader,
|
|
disableEsLint,
|
|
addBundleVisualizer,
|
|
fixBabelImports,
|
|
} = require("customize-cra");
|
|
|
|
|
|
const UglifyJsPlugin = require("uglifyjs-webpack-plugin")
|
|
const myPlugin = [
|
|
new UglifyJsPlugin(
|
|
{
|
|
uglifyOptions: {
|
|
warnings: false,
|
|
compress: {
|
|
drop_debugger: true,
|
|
drop_console: true
|
|
}
|
|
}
|
|
}
|
|
)
|
|
]
|
|
|
|
module.exports = override(
|
|
disableEsLint(),
|
|
process.env.BUNDLE_VISUALIZE == 1 && addBundleVisualizer(),
|
|
fixBabelImports('import', {
|
|
libraryName: 'antd-mobile',
|
|
style: 'css',
|
|
}),
|
|
addLessLoader({
|
|
strictMath: true,
|
|
noIeCompat: true
|
|
}),
|
|
(config) => {
|
|
if (process.env.NODE_ENV === "production") config.devtool = false;
|
|
if (process.env.NODE_ENV !== "development") config.plugins = [...config.plugins, ...myPlugin]
|
|
if (process.env.NODE_ENV !== "development") {
|
|
config.output.publicPath = `/h5educoderbuild/`;
|
|
}
|
|
return config
|
|
}
|
|
|
|
); |