refactor: 调整 eslint.config.js,优化代码格式

This commit is contained in:
2024-10-28 21:20:08 +08:00
parent 0e8fe5ff1f
commit 9e5dff144b
176 changed files with 5956 additions and 5624 deletions

View File

@@ -12,21 +12,21 @@ export default defineConfig(({ command, mode }) => {
resolve: {
alias: {
'~': fileURLToPath(new URL('./', import.meta.url)),
'@': fileURLToPath(new URL('./src', import.meta.url))
}
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
// 引入sass全局样式变量
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@/styles/var.scss";`,
api: 'modern-compiler'
}
}
api: 'modern-compiler',
},
},
},
// 添加需要vite优化的依赖
optimizeDeps: {
include: ['vue-draggable-plus']
include: ['vue-draggable-plus'],
},
server: {
// 服务启动时是否自动打开浏览器
@@ -37,9 +37,9 @@ export default defineConfig(({ command, mode }) => {
target: env.VITE_API_BASE_URL, // 后台服务器地址
changeOrigin: true, // 是否允许不同源
secure: false, // 支持https
rewrite: (path) => path.replace(/^\/api/, '')
}
}
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
plugins: createVitePlugins(env, command === 'build'),
// 构建
@@ -51,22 +51,22 @@ export default defineConfig(({ command, mode }) => {
compress: {
keep_infinity: true, // 防止 Infinity 被压缩成 1/0这可能会导致 Chrome 上的性能问题
drop_console: true, // 生产环境去除 console
drop_debugger: true // 生产环境去除 debugger
drop_debugger: true, // 生产环境去除 debugger
},
format: {
comments: false // 删除注释
}
comments: false, // 删除注释
},
},
// 静态资源打包到dist下的不同目录
rollupOptions: {
output: {
chunkFileNames: 'static/js/[name]-[hash].js',
entryFileNames: 'static/js/[name]-[hash].js',
assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
}
}
assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
},
},
},
// 以 envPrefix 开头的环境变量会通过 import.meta.env 暴露在你的客户端源码中。
envPrefix: ['VITE', 'FILE']
envPrefix: ['VITE', 'FILE'],
}
})