ag-special-sale/vite.config.js.timestamp-17...

193 lines
22 KiB
JavaScript
Raw Normal View History

2024-07-18 10:36:22 +08:00
// vite.config.js
import { defineConfig, loadEnv } from "file:///C:/Users/%E5%86%B0%E5%93%A5%E5%93%A5%E7%9A%84%E7%94%B5%E8%84%91/Desktop/xysale/node_modules/vite/dist/node/index.js";
import vue from "file:///C:/Users/%E5%86%B0%E5%93%A5%E5%93%A5%E7%9A%84%E7%94%B5%E8%84%91/Desktop/xysale/node_modules/@vitejs/plugin-vue/dist/index.mjs";
import AutoImport from "file:///C:/Users/%E5%86%B0%E5%93%A5%E5%93%A5%E7%9A%84%E7%94%B5%E8%84%91/Desktop/xysale/node_modules/unplugin-auto-import/dist/vite.js";
import Components from "file:///C:/Users/%E5%86%B0%E5%93%A5%E5%93%A5%E7%9A%84%E7%94%B5%E8%84%91/Desktop/xysale/node_modules/unplugin-vue-components/dist/vite.js";
import { ElementPlusResolver } from "file:///C:/Users/%E5%86%B0%E5%93%A5%E5%93%A5%E7%9A%84%E7%94%B5%E8%84%91/Desktop/xysale/node_modules/unplugin-vue-components/dist/resolvers.js";
import path from "path";
import { VxeTableResolver } from "file:///C:/Users/%E5%86%B0%E5%93%A5%E5%93%A5%E7%9A%84%E7%94%B5%E8%84%91/Desktop/xysale/node_modules/@vxecli/import-unplugin-vue-components/dist/index.mjs";
import CssMinimizerPlugin from "file:///C:/Users/%E5%86%B0%E5%93%A5%E5%93%A5%E7%9A%84%E7%94%B5%E8%84%91/Desktop/xysale/node_modules/css-minimizer-webpack-plugin/dist/index.js";
import TerserPlugin from "file:///C:/Users/%E5%86%B0%E5%93%A5%E5%93%A5%E7%9A%84%E7%94%B5%E8%84%91/Desktop/xysale/node_modules/terser-webpack-plugin/dist/index.js";
var __vite_injected_original_dirname = "C:\\Users\\\u51B0\u54E5\u54E5\u7684\u7535\u8111\\Desktop\\xysale";
var name = "\u7231\u679C\u6218\u58D5\u6258\u7BA1\u7CFB\u7EDF";
var port = process.env.port || process.env.npm_config_port || 80;
var vite_config_default = defineConfig((command, mode) => {
const env = loadEnv(mode, __vite_injected_original_dirname);
return {
publicPath: "./",
outputDir: "dist",
assetsDir: "static",
lintOnSave: env.VITE_MODE === "development",
//lintOnSave: false,
productionSourceMap: false,
plugins: [
vue(),
AutoImport({
resolvers: [ElementPlusResolver(), VxeTableResolver()]
}),
Components({
resolvers: [ElementPlusResolver(), VxeTableResolver()]
})
],
define: {
"process.env": {
VITE_APP_BASE_API: "JSON.stringify(env.VUE_APP_BASE_API)",
VITE_APP_BASE_SITE: "JSON.stringify(env.VITE_APP_BASE_SITE)"
}
},
server: {
port,
open: true,
hot: true,
overlay: {
warnings: false,
errors: true
},
host: "0.0.0.0",
proxy: {
[process.env.VUE_APP_BASE_API]: {
//这里是公共部分,在调用接口时后面接不相同的部分
target: process.env.VUE_APP_BASE_API,
//修改后台接口地址
changeOrigin: true,
//开启跨域
pathRewrite: {
//重命名
["^" + process.env.VUE_APP_BASE_API]: ""
}
},
"^/api": {
target: "http://dev-erp-api.xtkj99.com:7890",
changeOrigin: true
}
},
disableHostCheck: true
},
resolve: {
// 设置路径别名
alias: {
"@": path.join(__vite_injected_original_dirname, "/src"),
"@services": path.join(__vite_injected_original_dirname, "/src/services"),
"@axioshooks": path.join(__vite_injected_original_dirname, "/src/services/axioshooks"),
"@assets": path.join(__vite_injected_original_dirname, "/src/assets"),
"@components": path.join(__vite_injected_original_dirname, "/src/components"),
"@api": path.join(__vite_injected_original_dirname, "/src/services/api"),
"@untils": path.join(__vite_injected_original_dirname, "/src/untils")
}
},
css: {
// 是否使用css分离插件 ExtractTextPlugin
extract: {
filename: `static/js/chunk-[hash].css`
}
},
configureWebpack: {
output: {
filename: `static/js/chunk-[hash].js`
},
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__vite_injected_original_dirname, "../src"),
exclude: /node_modules/,
use: [
"cache-loader",
{
loader: "thread-loader",
options: {
workers: 2
}
},
"bable-loader"
]
}
]
}
},
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
name,
optimization: {
minimizer: [
// For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
// `...`,
new CssMinimizerPlugin(),
new TerserPlugin({
terserOptions: {
compress: {
drop_console: true
// 生产环境自动删除console
}
}
})
]
},
chainWebpack(config) {
config.plugin("preload").tap(() => [
{
rel: "preload",
// to ignore runtime.js
// https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
include: "initial"
}
]);
config.plugins.delete("prefetch");
config.module.rule("svg").exclude.add(resolve("src/icons")).end();
config.module.rule("icons").test(/\.svg$/).include.add(resolve("src/icons")).end().use("svg-sprite-loader").loader("svg-sprite-loader").options({
symbolId: `icon-[name].${Version}.[ext]`
}).end();
config.when(process.env.NODE_ENV !== "development", (config2) => {
config2.plugin("ScriptExtHtmlWebpackPlugin").after("html").use("script-ext-html-webpack-plugin", [
{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}
]).end();
config2.optimization.splitChunks({
chunks: "all",
cacheGroups: {
libs: {
name: "chunk-libs",
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: "initial"
// only package third parties that are initially dependent
},
elementUI: {
name: "chunk-elementUI",
// split elementUI into a single package
priority: 20,
// the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/
// in order to adapt to cnpm
},
commons: {
name: "chunk-commons",
test: resolve("src/components"),
// can customize your rules
minChunks: 3,
// minimum common number
priority: 5,
reuseExistingChunk: true
}
}
});
config2.optimization.runtimeChunk("single");
config2.optimization.minimizer("terser").tap((args) => {
args[0].parallel = 4;
args[0].terserOptions.compress.warnings = true;
args[0].terserOptions.compress.drop_debugger = true;
args[0].terserOptions.compress.drop_console = true;
return args;
});
});
}
};
});
export {
vite_config_default as default
};
//# sourceMappingURL=data:application/json;base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