Files
lilishop-ui/manager/vue.config.js
田香琪 ec948b5496 feat: 增强组件功能与样式优化
- 在多个组件中添加了新的属性和方法以提升功能性,如在卡片组件中引入 _ActiveTab 属性以管理活动标签。
- 优化了商品详情和商户页面的收藏逻辑,确保在未登录状态下引导用户登录。
- 更新了轮播组件的路由解析逻辑,增强了用户体验。
- 改进了投诉列表和收藏列表的样式,提升了响应式布局和可读性。
- 在全局配置中添加了对开发环境的错误处理,提升了调试体验。
2026-06-25 16:52:46 +08:00

88 lines
2.1 KiB
JavaScript

const path = require("path");
const configs = require("./src/config");
const CompressionPlugin = require("compression-webpack-plugin");
const resolve = (dir) => path.join(__dirname, dir);
const enableProduction = process.env.NODE_ENV === "production";
module.exports = {
css: {
loaderOptions: {
less: {
lessOptions: {
javascriptEnabled: true,
},
},
scss: {
sassOptions: {
silenceDeprecations: ["legacy-js-api", "import"],
},
},
sass: {
sassOptions: {
silenceDeprecations: ["legacy-js-api", "import"],
},
},
},
},
devServer: {
port: configs.port,
client: {
overlay: {
runtimeErrors: (error) => {
const message = error?.message || "";
if (message.includes("ResizeObserver loop")) {
return false;
}
return true;
},
},
},
},
productionSourceMap: false,
configureWebpack: {
plugins: enableProduction
? [
new CompressionPlugin({
test: /\.js$|\.html$|\.css/,
threshold: 10240,
}),
]
: [],
optimization: {
runtimeChunk: "single",
splitChunks: {
chunks: "all",
maxInitialRequests: Infinity,
minSize: 20000,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
const match = module.context && module.context.match(
/[\\/]node_modules[\\/](.*?)([\\/]|$)/
);
const packageName = match ? match[1] : "vendor";
return `npm.${packageName.replace("@", "")}`;
},
},
},
},
},
},
chainWebpack(config) {
config.resolve.alias.set("@", resolve("src"));
config.plugin("html").tap((args) => {
args[0].cdn = { css: [], js: [] };
return args;
});
},
pluginOptions: {
"style-resources-loader": {
preProcessor: "scss",
patterns: [path.resolve(__dirname, "./src/styles/common.scss")],
},
},
};