“scripts”: {
- “start”: “react-scripts start”,
- “start”: “craco start”,
- “build”: “react-scripts build”,
- “build”: “craco build”,
- “test”: “react-scripts test”,
- “test”: “craco test”,
}
4.在生产模式下取消控制台的console配置
取消console,最常用方法是安装uglifyjs-webpack-plugin
const UglifyJsPlugin = require(‘uglifyjs-webpack-plugin’);
const UglifyJsPlugin = require(‘uglifyjs-webpack-plugin’);
module.exports = {
webpack: {
// 别名
alias: {
“@”: path.resolve(“src”),
},
plugins: [
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false,
drop_debugger: true,
drop_console: true,
},
},
sourceMap: false,
parallel: true,
}),
],
}