-
-
Notifications
You must be signed in to change notification settings - Fork 296
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
Conversation
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); | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this 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') { |
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…ts w/o filename extension
Makes rollup-plugin-import-meta-assets ignore references to directories such as e.g.
new URL('./', import.meta.url)