代码拉取完成,页面将自动刷新
/* craco.config.js */
const CracoLessPlugin = require('craco-less');
const WebpackBar = require('webpackbar')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const path = require('path')
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
module.exports = {
devServer: {
host: "localhost",
client: {
progress: true,
},
},
webpack: {
cache: true,
configure: (webpackConfig, { env, paths }) => {
//webpackConfig.stats = 'errors-only'//这样才会生效
// 修改build的生成文件名称
paths.appBuild = 'dist';
webpackConfig.output = {
...webpackConfig.output,
path: path.resolve(__dirname, 'dist'),
publicPath: '/'
}//修改输出为dist文件
// console.log(webpackConfig);//不懂怎样修改的可以看一下webpackConfig有啥,然后对它的一直配置进行修改。
return webpackConfig
},
plugins: [
new UglifyJsPlugin({
uglifyOptions: {
compress: {
drop_debugger: true,
//清楚console
drop_console: true,
},
},
sourceMap: false,
parallel: true,
}),
/* new BundleAnalyzerPlugin(), */
new WebpackBar({
profile: true,
color: '#fa8c16',
})
],
optimization: {
splitChunks: {
cacheGroups: {
commons: {
chunks: 'initial',
minChunks: 2, maxInitialRequests: 5,
minSize: 0
},
vendor: {
test: /node_modules/,
chunks: 'initial',
name: 'vendor',
priority: 10,
enforce: true
}
}
}
}
},
plugins: [
{
plugin: CracoLessPlugin,
options: {
sourceMap: false,
lessLoaderOptions: {
lessOptions: {
modifyVars: { '@primary-color': '#008060' },
javascriptEnabled: true,
},
},
},
}
],
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。