Skip to content

Commit

Permalink
feat: rm no use code
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-advokate committed Sep 4, 2024
1 parent dee5a7e commit 7b46f44
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 243 deletions.
48 changes: 2 additions & 46 deletions build/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const getEnvConfig = (env) => {
let envConfig = {};
const envConfig = {};
for (const envName of Object.keys(env)) {
let envValue = env[envName].replace(/\\n/g, "\n");
envValue = envValue === "true" ? true : envValue === "false" ? false : envValue;
Expand All @@ -10,7 +10,7 @@ export const getEnvConfig = (env) => {
try {
envValue = JSON.parse(envValue);
} catch (e) {
console.log("VITE_PROXY error");
console.log("VITE_PROXY error", e);
}
}
envConfig[envName] = envValue;
Expand All @@ -36,47 +36,3 @@ export const createProxy = (list = []) => {
}
return rel;
};

export const getBuild = (isBuild) => {
return {
target: "modules",
// polyfillDynamicImport: "", // boolean
outDir: "dist", // path.join(__dirname, "dist/render"),
assetsDir: "assets",
assetsInlineLimit: 5120, // 5MB
// 如果设置为false,整个项目中的所有 CSS 将被提取到一个 CSS 文件中
cssCodeSplit: true,
// cssTarget: true,
sourcemap: false,
rollupOptions: {
output: {
// Static resource classification and packaging
chunkFileNames: "assets/js/[name]-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js",
assetFileNames: "assets/[ext]/[name]-[hash].[ext]",
compact: true,
manualChunks: {
vue: ["vue", "vue-router", "pinia"],
echarts: ["echarts"],
},
},
},
// commonjsOptions: "",
// dynamicImportVarsOptions: "",
// lib: "",
// manifest: false, // manifest.json
// ssrManifest: false,
// ssr: false,
minify: "terser", // boolean | "terser" | "esbuild"
terserOptions: {
compress: {
drop_console: isBuild, // 生产环境去除console
drop_debugger: isBuild, // 生产环境去除debugger
},
},
// write: true,
// emptyOutDir: "", // outDiroutDir--emptyOutDir
chunkSizeWarningLimit: 2048,
// watch: 1024,
};
};
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"nprogress": "^0.2.0",
"pinia": "^2.2.2",
"qs": "^6.13.0",
"vue": "^3.4.38",
"vue": "^3.5.0",
"vue-i18n": "^9.14.0",
"vue-router": "^4.4.3"
},
Expand All @@ -89,11 +89,11 @@
"@eslint/js": "^9.9.1",
"@rollup/plugin-commonjs": "^26.0.1",
"@types/echarts": "^4.9.22",
"@types/node": "^20.16.3",
"@types/node": "^20.16.4",
"@types/qs": "^6.9.15",
"@vitejs/plugin-legacy": "^5.4.2",
"@vitejs/plugin-vue": "^5.1.3",
"@vue/compiler-sfc": "^3.4.38",
"@vue/compiler-sfc": "^3.5.0",
"autoprefixer": "^10.4.20",
"browserslist": "^4.23.3",
"conventional-changelog-conventionalcommits": "^8.0.0",
Expand All @@ -113,7 +113,7 @@
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.77.8",
"sass": "^1.78.0",
"sass-loader": "^16.0.1",
"stylelint": "^16.9.0",
"stylelint-config-recommended": "^14.0.1",
Expand All @@ -130,7 +130,7 @@
"unplugin-icons": "^0.19.2",
"unplugin-vue-components": "^0.27.4",
"unplugin-vue-define-options": "^1.4.9",
"vite": "^5.4.2",
"vite": "^5.4.3",
"vite-plugin-cdn-import": "^1.0.1",
"vite-plugin-checker": "^0.7.2",
"vite-plugin-compression2": "^1.2.0",
Expand Down
Loading

0 comments on commit 7b46f44

Please sign in to comment.