1 Star 0 Fork 236

Quincy/Pear Admin Ant

forked from Pear Admin/Pear Admin Ant 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vue.config.js 2.28 KB
一键复制 编辑 原始数据 按行查看 历史
/**
* webpack 配置(vue-cli提示的vue.config.js)
* @type {{devServer: {port: number, open: boolean}}}
*/
const path = require("path");
const resolve = dir => {
return path.join(__dirname, dir);
};
const isDev = process.env.NODE_ENV === "development";
const CompressionWebpackPlugin = require("compression-webpack-plugin");
const ProductionGzipExtensions = ["html", "js", "css", "svg"];
const WebpackBar = require("webpackbar");
const webpackBarName = "pear-admin";
module.exports = {
publicPath: "",
outputDir: "dist/admin",
devServer: {
open: true, // 启动后自动打开浏览器
port: 8080 // 端口
},
// 构建时开启多进程处理babel编译
parallel: require("os").cpus().length > 1,
configureWebpack(config) {
//配置根目录
return {
resolve: {
alias: {
"@": resolve("src")
}
},
plugins: [
new WebpackBar({
name: webpackBarName
})
]
};
},
chainWebpack(config) {
config.when(isDev, config => {
config.devtool("source-map");
});
config.plugins.delete("prefetch");
config.resolve.symlinks(true);
config.when(!isDev, config => {
config.devtool("none");
//splitChunks拆分
config.optimization.splitChunks({
chunks: "all",
cacheGroups: {
libs: {
name: "Chunk-Libs",
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: "initial"
},
AntdUI: {
name: "Chunk-Antd",
priority: 20,
test: /[\\/]node_modules[\\/]_?@ant-design(.*)/
}
}
});
//Gzip
config
.plugin("compression")
.use(CompressionWebpackPlugin, [
{
filename: "[path][base].gz[query]",
algorithm: "gzip",
test: new RegExp(
"\\.(" + ProductionGzipExtensions.join("|") + ")$"
),
threshold: 8192,
minRatio: 0.8
}
])
.end();
});
},
runtimeCompiler: true,
productionSourceMap: false,
css: {
// extract:true,
requireModuleExtension: true,
sourceMap: true,
loaderOptions: {
less: {
lessOptions: {
javascriptEnabled: true
}
}
}
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/QuincyLI/pear-admin-ant.git
git@gitee.com:QuincyLI/pear-admin-ant.git
QuincyLI
pear-admin-ant
Pear Admin Ant
master

搜索帮助