浏览代码

:gear: hotfix for module vite config

tags/0.0.1^2
J 3 年前
父节点
当前提交
d1c7dd2dca
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7
    1
      frontend/vite.config.js

+ 7
- 1
frontend/vite.config.js 查看文件

@@ -1,6 +1,12 @@
1 1
 import { defineConfig } from 'vite'
2 2
 import vue from '@vitejs/plugin-vue'
3 3
 
4
+import path from 'path'
5
+import { fileURLToPath } from 'url'
6
+
7
+const filename = fileURLToPath(import.meta.url)
8
+const dirname = path.dirname(filename)
9
+
4 10
 // https://vitejs.dev/config/
5 11
 export default defineConfig({
6 12
     css: {
@@ -14,7 +20,7 @@ export default defineConfig({
14 20
     plugins: [vue()],
15 21
     resolve: {
16 22
         alias: {
17
-            '@': require('path').resolve(__dirname, 'src'),
23
+            '@': path.resolve(dirname, 'src'),
18 24
         },
19 25
     },
20 26
 })

正在加载...
取消
保存