build:优化代码结构和安全性
- 添加代码混淆插件和分包插件 - 更新 .gitignore 文件,忽略自动导入文件 - 删除无用的类型定义文件 - 移除 VS Code 扩展推荐文件 -优化 Vite 配置,美化构建输出结构
This commit is contained in:
parent
4521cab242
commit
05822f2fd2
2
.gitignore
vendored
2
.gitignore
vendored
@ -30,3 +30,5 @@ coverage
|
||||
*.tsbuildinfo
|
||||
|
||||
*lock*
|
||||
|
||||
*auto.import*
|
||||
|
6
.vscode/extensions.json
vendored
6
.vscode/extensions.json
vendored
@ -1,6 +0,0 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"Vue.volar",
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
"p": "vite preview",
|
||||
"build-only": "vite build",
|
||||
"b": "vite build",
|
||||
"bp": "yarn b && yarn p",
|
||||
"type-check": "vue-tsc --build",
|
||||
"format": "prettier --write src/"
|
||||
},
|
||||
@ -26,12 +27,14 @@
|
||||
"alova": "^3.3.4",
|
||||
"ant-design-vue": "^4.2.6",
|
||||
"base64-arraybuffer": "^1.0.2",
|
||||
"javascript-obfuscator": "^4.1.1",
|
||||
"js-md5": "^0.8.3",
|
||||
"marked": "^16.1.2",
|
||||
"naive-ui": "^2.42.0",
|
||||
"pinia": "^3.0.3",
|
||||
"pinia-plugin-persistedstate": "^4.5.0",
|
||||
"sass-embedded": "^1.90.0",
|
||||
"vite-plugin-bundle-obfuscator": "^1.8.0",
|
||||
"vue": "^3.5.18",
|
||||
"vue-router": "^4.5.1"
|
||||
},
|
||||
@ -47,6 +50,8 @@
|
||||
"unplugin-auto-import": "^20.0.0",
|
||||
"unplugin-vue-components": "^29.0.0",
|
||||
"vite": "^7.0.6",
|
||||
"vite-plugin-chunk-split": "^0.5.0",
|
||||
"vite-plugin-obfuscator": "^1.0.5",
|
||||
"vite-plugin-vue-devtools": "^8.0.0",
|
||||
"vue-tsc": "^3.0.4"
|
||||
}
|
||||
|
@ -62,7 +62,6 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { getMyCar } from '@/apis/bacth';
|
||||
|
||||
import { UserStore } from '@/plugins';
|
||||
|
@ -49,7 +49,6 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { type FormInst, type FormItemRule } from 'naive-ui';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import message from '@/utils/message.ts';
|
||||
import { captcha, login } from '@/apis/auth';
|
||||
import { UserStore } from '@/plugins';
|
||||
|
@ -52,7 +52,6 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { type FormInst, type FormItemRule } from 'naive-ui';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import message from '@/utils/message.ts';
|
||||
import { captcha, register } from '@/apis/auth';
|
||||
import { UserStore } from '@/plugins';
|
||||
|
24
src/types/components.auto.d.ts
vendored
24
src/types/components.auto.d.ts
vendored
@ -1,24 +0,0 @@
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
// biome-ignore lint: disable
|
||||
export {}
|
||||
|
||||
/* prettier-ignore */
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
NAlert: typeof import('naive-ui')['NAlert']
|
||||
NButton: typeof import('naive-ui')['NButton']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NDescriptions: typeof import('naive-ui')['NDescriptions']
|
||||
NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem']
|
||||
NForm: typeof import('naive-ui')['NForm']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NGradientText: typeof import('naive-ui')['NGradientText']
|
||||
NInput: typeof import('naive-ui')['NInput']
|
||||
NText: typeof import('naive-ui')['NText']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
}
|
||||
}
|
@ -2,8 +2,11 @@ import { fileURLToPath, URL } from 'node:url';
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import AutoImport from 'unplugin-auto-import/vite';
|
||||
import { chunkSplitPlugin } from 'vite-plugin-chunk-split';
|
||||
import vueDevTools from 'vite-plugin-vue-devtools';
|
||||
import Components from 'unplugin-vue-components/vite';
|
||||
import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator';
|
||||
import {
|
||||
AntDesignVueResolver,
|
||||
IduxResolver,
|
||||
@ -21,21 +24,29 @@ export default defineConfig({
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
chunkFileNames: `[hash].js`,
|
||||
entryFileNames: `[hash].js`,
|
||||
assetFileNames: `[hash].[ext]`,
|
||||
},
|
||||
},
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
chunkFileNames: `assets/[name]/[hash].js`,
|
||||
entryFileNames: `assets/[name]/[hash].js`,
|
||||
assetFileNames: `assets/[name]/[hash].[ext]`,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
vueDevTools(),
|
||||
chunkSplitPlugin({
|
||||
strategy: 'single-vendor',
|
||||
}),
|
||||
AutoImport({
|
||||
imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
|
||||
dts: 'src/types/ts.auto.import.d.ts',
|
||||
}),
|
||||
vitePluginBundleObfuscator({
|
||||
excludes: [],
|
||||
enable: true,
|
||||
log: true,
|
||||
autoExcludeNodeModules: true,
|
||||
threadPool: true,
|
||||
}),
|
||||
Components({
|
||||
resolvers: [
|
||||
IduxResolver({
|
||||
@ -47,7 +58,7 @@ export default defineConfig({
|
||||
importStyle: 'less',
|
||||
}),
|
||||
],
|
||||
dts: 'src/types/components.auto.d.ts',
|
||||
dts: 'src/types/components.auto.import.d.ts',
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user