Преглед изворни кода

fix asset file name when development mode

Yuki Takei пре 2 година
родитељ
комит
ad8c8efda9
1 измењених фајлова са 31 додато и 29 уклоњено
  1. 31 29
      packages/preset-themes/vite.themes.config.ts

+ 31 - 29
packages/preset-themes/vite.themes.config.ts

@@ -1,35 +1,37 @@
 import { defineConfig } from 'vite';
 import { defineConfig } from 'vite';
 
 
-const isProd = process.env.NODE_ENV === 'production';
-
 // https://vitejs.dev/config/
 // https://vitejs.dev/config/
-export default defineConfig({
-  build: {
-    outDir: 'dist/themes',
-    manifest: true,
-    rollupOptions: {
-      input: [
-        // '/src/styles/antarctic.scss',
-        // '/src/styles/blackboard.scss',
-        // '/src/styles/christmas.scss',
-        '/src/styles/default.scss',
-        // '/src/styles/fire-red.scss',
-        // '/src/styles/future.scss',
-        // '/src/styles/halloween.scss',
-        // '/src/styles/hufflepuff.scss',
-        // '/src/styles/island.scss',
-        // '/src/styles/jade-green.scss',
-        // '/src/styles/kibela.scss',
-        '/src/styles/mono-blue.scss',
-        // '/src/styles/nature.scss',
-        // '/src/styles/spring.scss',
-        // '/src/styles/wood.scss',
-      ],
-      output: {
-        assetFileNames: isProd
-          ? undefined
-          : 'assets/[name].[ext]', // not attach hash
+export default defineConfig(({ mode }) => {
+  const isProd = mode === 'production';
+
+  return {
+    build: {
+      outDir: 'dist/themes',
+      manifest: true,
+      rollupOptions: {
+        input: [
+          // '/src/styles/antarctic.scss',
+          // '/src/styles/blackboard.scss',
+          // '/src/styles/christmas.scss',
+          '/src/styles/default.scss',
+          // '/src/styles/fire-red.scss',
+          // '/src/styles/future.scss',
+          // '/src/styles/halloween.scss',
+          // '/src/styles/hufflepuff.scss',
+          // '/src/styles/island.scss',
+          // '/src/styles/jade-green.scss',
+          // '/src/styles/kibela.scss',
+          '/src/styles/mono-blue.scss',
+          // '/src/styles/nature.scss',
+          // '/src/styles/spring.scss',
+          // '/src/styles/wood.scss',
+        ],
+        output: {
+          assetFileNames: isProd
+            ? undefined
+            : 'assets/[name].[ext]', // not attach hash
+        },
       },
       },
     },
     },
-  },
+  };
 });
 });