Skip to content

Commit 4cc78b4

Browse files
committedDec 28, 2023
fix: avoid breaking change from #128
1 parent fcea268 commit 4cc78b4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ export default (opts: PluginOptions = {}): Plugin => {
151151
},
152152
async resolveId(id, importer, options) {
153153
if (importer && !relativeImportRE.test(id) && !isAbsolute(id)) {
154+
// For Vite 4 and under, skipSelf needs to be set.
155+
const resolveOptions = { ...options, skipSelf: true }
154156
const viteResolve: ViteResolve = async (id, importer) =>
155-
(await this.resolve(id, importer, options))?.id
157+
(await this.resolve(id, importer, resolveOptions))?.id
156158

157159
let prevProjectDir: string | undefined
158160
let projectDir = dirname(importer)

0 commit comments

Comments
 (0)
Please sign in to comment.