-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
"Pre-bundling dependencies" in node_modules chunking does not respect plugins queue #5364
Comments
tldr: 'Pre-bundling dependencies' step should respect plugin transforms, or have a way to delay or skip some of them |
Vite's current architecture doesn't involve plugin transforms in the prebundling process, there are discussions around this though. At the meantime, you can use optimizeDeps.esbuildOptions.define or a esbuild plugin via |
@bluwy
|
You can make a custom esbuild plugin then that resolves |
How would you replace all occurrences of DEBUG with a boolean? Is that possible? That's what babel-plugin-debug-macros does 🤔 |
Closing as #5364 (comment) should do the trick.
You can use the define option, e.g. |
@bluwy it’s not global constant! Its variable |
I don't understand what do you mean, can you explain how the esbuild plugin isn't working for you? The contents of |
Describe the bug
Why?
Some libraries have DEBUG flag in codebase to ship more debugging information into development build,
but "Pre-bundling dependencies" does not respect plugins, responsible for this transformation, and it fails it.
I'm trying to configure debug globals in glimmex application, using vite plugin:
https://github.com/lifeart/vite-plugin-glimmerx
it has ordering:
enforce: "pre"
, and babel transformation itself works just fine, but (checked output), but, I don't see it applied to codebase (compiled node_modules dependency) once I have server running.I'm trying to replace source code manually, and it's also don't work (in "transform" plugin stage)
and I see generated chunk, not processed by plugin in
.vite
directory:looks like this "chinking" logic, likely located here: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/plugins/importAnalysisBuild.ts does not respect plugins queue...
related issue: glimmerjs/glimmer-vm#1350
Reproduction
https://github.com/lifeart/_vite_precompile_error_reproduction
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: