Skip to content

Commit bb66730

Browse files
committed
同步代码
1 parent a24b73b commit bb66730

File tree

4 files changed

+63
-17
lines changed

4 files changed

+63
-17
lines changed

.browserslistrc

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1-
> 1%
2-
last 2 versions
3-
not dead
1+
# 全球使用率超过 5%的浏览器
2+
> 5%
3+
4+
# 最近两个主要版本的浏览器 (including Chrome, Firefox, Safari, and Edge)
5+
last 2 major versions
6+
7+
# 对谷歌浏览器的要求
8+
chrome >80
9+
10+
# 排除官方不在维护已过两年的浏览器
11+
not dead
12+
13+
# 排除 Internet Explorer 11
14+
not IE 11

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@icon-park/svg": "^1.4.2",
2020
"@mars3d/heatmap.js": "^2.0.7",
2121
"@turf/turf": "^6.5.0",
22-
"ant-design-vue": "^4.0.6",
22+
"ant-design-vue": "^4.0.7",
2323
"axios": "^1.5.1",
2424
"core-js": "^3.33.1",
2525
"dayjs": "^1.11.10",
@@ -37,18 +37,19 @@
3737
"mars3d-space": "~3.6.0",
3838
"nprogress": "^0.2.0",
3939
"uuid": "^9.0.1",
40-
"vue": "^3.3.4",
40+
"vue": "^3.3.10",
4141
"vue-color-kit": "^1.0.6",
4242
"vue-router": "^4.2.5",
4343
"vuex": "^4.1.0"
4444
},
4545
"devDependencies": {
4646
"@types/node": "^20.8.7",
4747
"@typescript-eslint/eslint-plugin": "^6.8.0",
48-
"@vitejs/plugin-vue": "^4.4.0",
48+
"@vitejs/plugin-legacy": "^5.2.0",
49+
"@vitejs/plugin-vue": "^4.5.1",
4950
"@vue/eslint-config-typescript": "^12.0.0",
5051
"consola": "^3.2.3",
51-
"eslint": "^8.51.0",
52+
"eslint": "^8.55.0",
5253
"eslint-config-standard": "^17.1.0",
5354
"eslint-plugin-import": "^2.28.1",
5455
"eslint-plugin-node": "^11.1.0",
@@ -63,13 +64,13 @@
6364
"rollup-plugin-visualizer": "^5.9.2",
6465
"serve-static": "^1.15.0",
6566
"standard": "^17.1.0",
66-
"terser": "^5.22.0",
67-
"typescript": "5.2.2",
68-
"vite": "^4.5.0",
67+
"terser": "^5.25.0",
68+
"typescript": "~5.2.2",
69+
"vite": "^5.0.4",
6970
"vite-plugin-eslint": "^1.8.1",
7071
"vite-plugin-mars3d": "^3.1.3",
7172
"vite-plugin-style-import": "^2.0.0",
72-
"vue-tsc": "^1.8.19"
73+
"vue-tsc": "^1.8.24"
7374
},
7475
"engines": {
7576
"node": ">=16.0.0",

tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
"@mars/*": ["src/*"]
2727
}
2828
},
29-
"vueCompilerOptions": {
30-
"experimentalDisableTemplateSupport": true
31-
},
3229
"include": ["packages/**/*.ts", "src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
3330
"exclude": ["node_modules", "src/**/*.js", "dist"]
3431
}

vite.config.ts

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import path from "path"
22
import type { ConfigEnv } from "vite"
33
import { defineConfig, loadEnv } from "vite" // 帮手函数,这样不用 jsdoc 注解也可以获取类型提示
44
import vue from "@vitejs/plugin-vue"
5+
import legacy from "@vitejs/plugin-legacy"
56
import eslintPlugin from "vite-plugin-eslint"
67
import { mars3dPlugin } from "vite-plugin-mars3d"
78
import { createStyleImportPlugin, AndDesignVueResolve } from "vite-plugin-style-import"
@@ -18,14 +19,14 @@ export default ({ mode }: ConfigEnv) => {
1819
base: ENV.VITE_BASE_URL,
1920
server: {
2021
host: "localhost",
21-
https: false,
2222
port: 3002
2323
},
2424
define: {
2525
"process.env": {
2626
mode,
2727
BASE_URL: ENV.VITE_BASE_URL,
28-
API_BASE: ENV.VITE_API_URL
28+
API_BASE: ENV.VITE_API_URL,
29+
API_LOCAL: ENV.VITE_LOCAL_API
2930
},
3031
buildTime: new Date()
3132
},
@@ -64,26 +65,62 @@ export default ({ mode }: ConfigEnv) => {
6465
commonjsOptions: {
6566
include: /node_modules|packages/
6667
},
68+
// 静态资源目录
69+
assetsDir: "assets",
6770
// 自定义底层的 Rollup 打包配置
6871
rollupOptions: {
6972
input: {
7073
index: path.resolve(__dirname, "index.html"),
7174
demo: path.resolve(__dirname, "demo.html")
75+
},
76+
output: {
77+
chunkFileNames: "assets/js/[name]-[hash].js",
78+
entryFileNames: "assets/js/[name]-[hash].js",
79+
assetFileNames: "assets/[ext]/[name]-[hash].[ext]"
7280
}
7381
},
7482
// 当设置为 true, 构建后将会生成 manifest.json 文件
7583
manifest: false,
7684
// 设置为 false 可以禁用最小化混淆,或是用来指定是应用哪种混淆器 boolean | 'terser' | 'esbuild'
7785
minify: "terser",
7886
// 传递给 Terser 的更多 minify 选项
79-
terserOptions: {},
87+
terserOptions: {
88+
compress: {
89+
drop_console: true, // 在生产环境移除console.log
90+
drop_debugger: true // 在生产环境移除debugger
91+
}
92+
},
8093
// 设置为false 来禁用将构建好的文件写入磁盘
8194
write: true,
8295
// 默认情况下 若 outDir 在 root 目录下, 则 Vite 会在构建时清空该目录。
8396
emptyOutDir: true
8497
},
8598
plugins: [
8699
vue(),
100+
// 兼容老版本浏览器配置
101+
// legacy({
102+
// targets: ["> 5%", "last 2 major versions", "chrome >80", "not dead"], // 需要兼容的目标列表,可以设置多个,参考.browserslistrc等
103+
// additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
104+
// renderLegacyChunks: true,
105+
// polyfills: [
106+
// "es.symbol",
107+
// "es.array.filter",
108+
// "es.promise",
109+
// "es.promise.finally",
110+
// "es/map",
111+
// "es/set",
112+
// "es.array.for-each",
113+
// "es.object.define-properties",
114+
// "es.object.define-property",
115+
// "es.object.get-own-property-descriptor",
116+
// "es.object.get-own-property-descriptors",
117+
// "es.object.keys",
118+
// "es.object.to-string",
119+
// "web.dom-collections.for-each",
120+
// "esnext.global-this",
121+
// "esnext.string.match-all"
122+
// ]
123+
// }),
87124
eslintPlugin({ cache: false }),
88125
mars3dPlugin({ useStatic: false }),
89126
createStyleImportPlugin({

0 commit comments

Comments
 (0)