|
@@ -1,8 +1,7 @@
|
|
import { UserConfig, ConfigEnv, loadEnv, defineConfig } from 'vite';
|
|
import { UserConfig, ConfigEnv, loadEnv, defineConfig } from 'vite';
|
|
-
|
|
|
|
import createPlugins from './vite/plugins';
|
|
import createPlugins from './vite/plugins';
|
|
-
|
|
|
|
import path from 'path';
|
|
import path from 'path';
|
|
|
|
+const timeStamp = new Date().getTime();
|
|
export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
|
|
export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
|
|
const env = loadEnv(mode, process.cwd());
|
|
const env = loadEnv(mode, process.cwd());
|
|
return {
|
|
return {
|
|
@@ -50,6 +49,19 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
|
|
]
|
|
]
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ build: {
|
|
|
|
+ outDir: "dist", //想要把dist修改成什么名字在这边改
|
|
|
|
+ // 自定义底层的 Rollup 打包配置(Rollup文档地址:https://cn.rollupjs.org/configuration-options/)
|
|
|
|
+ rollupOptions: {
|
|
|
|
+ // 输出配置
|
|
|
|
+ output: {
|
|
|
|
+ // 输出的文件自定义命名
|
|
|
|
+ chunkFileNames: `assets/[name]-[hash].${timeStamp}.js`,
|
|
|
|
+ entryFileNames: `assets/[name]-[hash].${timeStamp}.js`,
|
|
|
|
+ assetFileNames: `assets/[name]-[hash].${timeStamp}.[ext]`,
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
// 预编译
|
|
// 预编译
|
|
optimizeDeps: {
|
|
optimizeDeps: {
|
|
include: [
|
|
include: [
|