From 1d083ce26944537cc5e042d583ac3c8d4bf20942 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 24 Nov 2021 19:00:06 +0800 Subject: [PATCH] fix: use `fileURLToPath` instead of `.pathname` to fix unicode compatibility Fixes #5 --- template/base/vite.config.js | 4 +++- template/config/jsx/vite.config.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/template/base/vite.config.js b/template/base/vite.config.js index 24c2e504..6ff2d33a 100644 --- a/template/base/vite.config.js +++ b/template/base/vite.config.js @@ -1,3 +1,5 @@ +import { fileURLToPath } from 'url' + import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' @@ -6,7 +8,7 @@ export default defineConfig({ plugins: [vue()], resolve: { alias: { - '@/': new URL('./src/', import.meta.url).pathname + '@/': fileURLToPath(new URL('./src/', import.meta.url)) } } }) diff --git a/template/config/jsx/vite.config.js b/template/config/jsx/vite.config.js index 032e163c..5be11429 100644 --- a/template/config/jsx/vite.config.js +++ b/template/config/jsx/vite.config.js @@ -1,3 +1,5 @@ +import { fileURLToPath } from 'url' + import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' @@ -7,7 +9,7 @@ export default defineConfig({ plugins: [vue(), vueJsx()], resolve: { alias: { - '@/': new URL('./src/', import.meta.url).pathname + '@/': fileURLToPath(new URL('./src/', import.meta.url)) } } }) -- 2.39.5