Просмотр исходного кода

overwrite assetFileNames when dev

Yuki Takei 3 лет назад
Родитель
Сommit
a4324239c3

+ 1 - 1
packages/preset-themes/package.json

@@ -9,9 +9,9 @@
   ],
   "scripts": {
     "build": "yarn build:libs & yarn build:themes",
-    "build:w": "yarn build:libs -w & yarn build:themes -w",
     "build:libs": "vite -c vite.libs.config.ts build",
     "build:themes": "vite -c vite.themes.config.ts build",
+    "dev": "yarn build:libs --mode dev -w & yarn build:themes --mode dev -w",
     "lint:eslint": "eslint --quiet \"**/*.{js,jsx,ts,tsx}\"",
     "lint:styles": "stylelint src/**/*.scss",
     "lint": "run-p lint:*",

+ 7 - 0
packages/preset-themes/vite.themes.config.ts

@@ -1,5 +1,7 @@
 import { defineConfig } from 'vite';
 
+const isProd = process.env.NODE_ENV === 'production';
+
 // https://vitejs.dev/config/
 export default defineConfig({
   build: {
@@ -23,6 +25,11 @@ export default defineConfig({
         '/src/styles/spring.scss',
         '/src/styles/wood.scss',
       ],
+      output: {
+        assetFileNames: isProd
+          ? undefined
+          : 'assets/[name].[ext]', // not attach hash
+      },
     },
   },
 });