From 21204184f73da196ae9d7a420368dc29d9bbc92b Mon Sep 17 00:00:00 2001 From: Linzhi Xie Date: Thu, 15 Aug 2024 11:13:45 +0800 Subject: [PATCH 1/2] chore: support vite use @ alias --- packages/taro-cli/templates/default/config/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/taro-cli/templates/default/config/index.js b/packages/taro-cli/templates/default/config/index.js index 97e8de997a2c..4c441f16d184 100644 --- a/packages/taro-cli/templates/default/config/index.js +++ b/packages/taro-cli/templates/default/config/index.js @@ -31,6 +31,10 @@ export default defineConfig{{#if typescript }}<'{{ to_lower_case compiler }}'>{{ cache: { enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache },{{/if}} + {{#if eq compiler "Vite"}} + alias: { + "@": path.resolve(__dirname, "../src"), + },{{/if}} mini: { postcss: { pxtransform: { From 3695dbaaab090f0aabb97ebc27ca9fc4e7613473 Mon Sep 17 00:00:00 2001 From: Linzhi Xie Date: Thu, 15 Aug 2024 11:16:45 +0800 Subject: [PATCH 2/2] chore: support vite use @ alias --- packages/taro-cli/templates/default/config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taro-cli/templates/default/config/index.js b/packages/taro-cli/templates/default/config/index.js index 4c441f16d184..b252f30e0695 100644 --- a/packages/taro-cli/templates/default/config/index.js +++ b/packages/taro-cli/templates/default/config/index.js @@ -31,7 +31,7 @@ export default defineConfig{{#if typescript }}<'{{ to_lower_case compiler }}'>{{ cache: { enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache },{{/if}} - {{#if eq compiler "Vite"}} + {{#if (eq compiler "Vite")}} alias: { "@": path.resolve(__dirname, "../src"), },{{/if}}