From 4b5f7bb0bf610e77aaeb1ef9af93d5f0694041a8 Mon Sep 17 00:00:00 2001 From: Jaya Krishna Date: Mon, 7 Aug 2023 21:07:07 +0530 Subject: [PATCH] (fix): Improve the check for vite/ imports --- plugin/package.json | 4 ++-- plugin/src/index.ts | 8 ++++---- pnpm-lock.yaml | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plugin/package.json b/plugin/package.json index 0d6d80f..7cb6033 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -35,12 +35,12 @@ "@vue/compiler-dom": "^3.2.31" }, "dependencies": { - "@jspm/generator": "^1.1.1" + "@jspm/generator": "^1.1.9" }, "peerDependencies": { "vite": "*" }, "engines": { - "node": ">=14.0.0" + "node": ">=18" } } diff --git a/plugin/src/index.ts b/plugin/src/index.ts index 90093ae..78276a3 100644 --- a/plugin/src/index.ts +++ b/plugin/src/index.ts @@ -90,8 +90,8 @@ async function plugin(pluginOptions?: PluginOptions): Promise { if ( id.startsWith("/") || id.startsWith(".") || - id.startsWith("vite/") || - id.startsWith("__vite") || + id.includes("vite/") || + id.includes("__vite") || id.includes(".css") || id.includes(".html") || path.isAbsolute(id) || @@ -127,7 +127,7 @@ async function plugin(pluginOptions?: PluginOptions): Promise { return null; } - if (id.startsWith("vite/") || path.isAbsolute(id)) { + if (id.includes("vite/") || path.isAbsolute(id)) { return; } @@ -163,7 +163,7 @@ async function plugin(pluginOptions?: PluginOptions): Promise { return { id, external: true }; }, async load(id) { - if (id?.startsWith("vite/") || !id?.startsWith("http")) { + if (id?.includes("vite/") || !id?.includes("http")) { return; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 470efdf..c5056fc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,5 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - importers: .: @@ -60,8 +56,8 @@ importers: plugin: dependencies: '@jspm/generator': - specifier: ^1.1.1 - version: 1.1.1(google-protobuf@3.21.2) + specifier: ^1.1.9 + version: 1.1.9(google-protobuf@3.21.2) vite: specifier: '*' version: 4.1.1(@types/node@18.0.0) @@ -836,8 +832,8 @@ packages: '@jridgewell/sourcemap-codec': 1.4.14 dev: false - /@jspm/generator@1.1.1(google-protobuf@3.21.2): - resolution: {integrity: sha512-ni7DWLWT/Dh+QLpvC58g+5HPvojcSDauisJrEQnXqe4bdPQunQEoORi+9LqovM5baTPW2odXQQiQqpxOAhEvkA==} + /@jspm/generator@1.1.9(google-protobuf@3.21.2): + resolution: {integrity: sha512-ZSr+yeceUv/+h8tMH68bvzMWwe4rzW+ihx94N0f7ifGLUvT2r7I/tS7l1hpB0kMtL+DIfgS7ENt5gpQIXgrdrQ==} dependencies: '@babel/core': 7.21.3 '@babel/plugin-syntax-import-assertions': 7.20.0(@babel/core@7.21.3) @@ -3458,3 +3454,7 @@ packages: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} engines: {node: '>=12.20'} dev: true + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false