-
Notifications
You must be signed in to change notification settings - Fork 192
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
CRXJS breaks dynamic imports by removing "" around imports #608
Comments
Same issue with 2.0.0-beta.9 @A-Shleifman Did you find a workaround / know a previous version that worked?
|
const distPath = '/src/utils/index.ts.js';
await import(distPath); This goes around Vite (which is bad) and it works, BUT only if this file has already been transpiled before. Any changes to this file and descendants will never be loaded even after a restart. This wouldn't work even as a temporary solution. |
@A-Shleifman I was able to find the source of the issue. |
Thank you, @lionelhorn, for looking into this and finding a way to fix the problem. I dug a bit deeper and apparently it's caused by an inconsistency/bug in the lexer. I opened an issue. Regarding your fork:
Do you mind if we merge the fix for this issue separately from the posix fix? |
Thanks @A-Shleifman for digging deeper.
Indeed, realized that prettier issue after the fact. I didn't have time to do a proper PR at the time, that's why I only linked my fork for hints to those interesed.
I've seen that PR. That's what I added dirtily on top of 7342ff0
Didn't get a chance to test the modifications outside of windows. |
If it helps, this is the error I got when building your fork on my mac: [!] (plugin bundleClientCode) TypeError: Could not load client//Users/redacted/chrome-extension-tools/packages/vite-plugin/src/client/es/hmr-client-worker.ts (imported by src/node/plugin-background.ts): Invalid URL
TypeError: Could not load client//Users/redacted/chrome-extension-tools/packages/vite-plugin/src/client/es/hmr-client-worker.ts (imported by src/node/plugin-background.ts): Invalid URL
at new NodeError (node:internal/errors:387:5)
at URL.onParseError (node:internal/url:564:9)
at new URL (node:internal/url:640:5)
at Object.load (/Users/redacted/chrome-extension-tools/packages/vite-plugin/rollup.config.ts:68:21)
at /Users/redacted/chrome-extension-tools/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/shared/rollup.js:22841:40 |
@jacksteamdev, can we merge #630? |
Build tool
Vite
Where do you see the problem?
Describe the bug
CRXJS breaks dynamic imports by removing "" around imports
input
output
Imports should be wrapped in quotes, otherwise, they don't work.
These imports work when the project is launched with Vite without CRXJS.
Reproduction
Example provided above
Logs
No response
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: