Browse Source

Merge pull request #1810 from QuentinHsu/feature/alias-path

feat: add jsconfig.json and configure path aliases
IcedTangerine 3 tháng trước cách đây
mục cha
commit
c0fb3bf95f
2 tập tin đã thay đổi với 15 bổ sung0 xóa
  1. 9 0
      web/jsconfig.json
  2. 6 0
      web/vite.config.js

+ 9 - 0
web/jsconfig.json

@@ -0,0 +1,9 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "paths": {
+      "@/*": ["src/*"]
+    }
+  },
+  "include": ["src/**/*"]
+}

+ 6 - 0
web/vite.config.js

@@ -20,10 +20,16 @@ For commercial licensing, please contact [email protected]
 import react from '@vitejs/plugin-react';
 import { defineConfig, transformWithEsbuild } from 'vite';
 import pkg from '@douyinfe/vite-plugin-semi';
+import path from 'path';
 const { vitePluginSemi } = pkg;
 
 // https://vitejs.dev/config/
 export default defineConfig({
+  resolve: {
+    alias: {
+      '@': path.resolve(__dirname, './src'),
+    },
+  },
   plugins: [
     {
       name: 'treat-js-files-as-jsx',