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(rollup-plugin-import-meta-assets): fix #2421 #2422

Merged
merged 2 commits into from
Aug 24, 2023
Merged

fix(rollup-plugin-import-meta-assets): fix #2421 #2422

merged 2 commits into from
Aug 24, 2023

Conversation

undecaf
Copy link
Contributor

@undecaf undecaf commented Aug 22, 2023

Makes rollup-plugin-import-meta-assets ignore references to directories such as e.g. new URL('./', import.meta.url)

Makes rollup-plugin-import-meta-assets ignore references
to directories such as e.g. new URL('./', import.meta.url)
this.warn(error, node.arguments[0].start);
} else {
this.error(error, node.arguments[0].start);
}
Copy link
Member

Choose a reason for hiding this comment

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

I think we should instead match only expressions which contain an extension in the path by patching isNewUrlImportMetaUrl method, so that we don't even run into this error

also maybe good to rename isNewUrlImportMetaUrl to isNewUrlAssetUrl

Copy link
Member

Choose a reason for hiding this comment

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

this comment address this, so I'm OK with the current check for EISDIR

Copy link
Member

@bashmish bashmish left a comment

Choose a reason for hiding this comment

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

thanks for the fix! nice work 👍

just a small remark to clarify this specific logic in code for future generations :)

this.warn(error, node.arguments[0].start);
} else {
this.error(error, node.arguments[0].start);
if (error.code !== 'EISDIR') {
Copy link
Member

@bashmish bashmish Aug 24, 2023

Choose a reason for hiding this comment

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

I'd add a comment that this ignores dirs and needs to be done like this to have confidence it's a dir on the file system level (like a summary of #2421 (comment))

Copy link
Member

Choose a reason for hiding this comment

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

actually, you can also make a test by creating a file without an extension and making sure it's processed correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@bashmish bashmish merged commit 2b27a2d into modernweb-dev:master Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants