From 4cc78b4816eb7eea13cae878d8a4b6da8d691c27 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Thu, 28 Dec 2023 13:53:21 -0500 Subject: [PATCH] fix: avoid breaking change from #128 --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index ddd50d9..c7e457d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -151,8 +151,10 @@ export default (opts: PluginOptions = {}): Plugin => { }, async resolveId(id, importer, options) { if (importer && !relativeImportRE.test(id) && !isAbsolute(id)) { + // For Vite 4 and under, skipSelf needs to be set. + const resolveOptions = { ...options, skipSelf: true } const viteResolve: ViteResolve = async (id, importer) => - (await this.resolve(id, importer, options))?.id + (await this.resolve(id, importer, resolveOptions))?.id let prevProjectDir: string | undefined let projectDir = dirname(importer)