Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forward options when calling this.resolve #128

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ export default (opts: PluginOptions = {}): Plugin => {
}
})
},
async resolveId(id, importer) {
async resolveId(id, importer, options) {
if (importer && !relativeImportRE.test(id) && !isAbsolute(id)) {
const viteResolve: ViteResolve = async (id, importer) =>
(await this.resolve(id, importer, { skipSelf: true }))?.id
(await this.resolve(id, importer, options))?.id
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still needs skipSelf: true I think?

Copy link
Contributor Author

@pcattori pcattori Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the Vite docs for this.resolve:

The default of skipSelf is true

But no harm (I think?) in setting it explicitly too if you prefer.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice. That's a welcome change from Rollup :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a breaking changes for people still using Vite 3-4?
Rollup changed the default into v4, which is used by Vite 5, thus this is a breaking change and would need a proper major release

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IlCallo Ah good point! I think I'll explicitly set skipSelf: true for backwards compatibility.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in v4.2.3

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 😁


let prevProjectDir: string | undefined
let projectDir = dirname(importer)
Expand Down