fix: don't handle file ids that begin with a null byte #530
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Rollup has a convention of prefixing some paths with a null byte (
\0
). Most plugins should just ignore files prefixed with the null byte, and this PR adds the proper handling to the electron-vite asset plugin.Additional context
This bug is seen in issues like #524 where there's an error:
As noted in Rollups "conventions" page:
https://rollupjs.org/plugin-development/#conventions
In this case, the electron-vite plugin is not using virtual modules, but if other plugins are using it, electron-vite should not try to process the file.
Similar handling is done in vite's built-in asset plugin:
https://github.com/vitejs/vite/blob/a826a08736075049842c8addff66fe385008572a/packages/vite/src/node/plugins/asset.ts#L173-L182
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).