-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Support static replacement from transformers #5405
Comments
Asking once again: in which files should this replacement be done? |
Just in Vue's internal files, nowhere else. Sorry for not clarifying. |
These would be a kind of global configuration. The Vue transformer would certainly not be able to set them... One possibility would be setting them similar to these config options: https://v2.parceljs.org/features/node-emulation/#%F0%9F%94%A7-disabling-these-features. I think this would be fine for Vue's usecase? |
The reason those don't work is that the globals are not defined on |
I was thinking of: {
"name": "my-project",
"dependencies": {
...
},
"@parcel/transformer-js": {
"define": {
"__VUE_OPTIONS_API__": false,
}
}
}
Propagating the meta properties unconditionally to every child recursively? That's not an option |
We also want to prevent feature creep on JS transformer though. The alternative would be a specific transformer for this (which could also reuse the previous ASTs). |
I just ran into another usecase of replacing globals. |
What types of values would be supported? Just JSON stringifyable types? |
🙋 feature request
Support custom replacement of build-time constants.
🤔 Expected Behavior
It is possible to run custom replacements on JavaScript from a transformer.
😯 Current Behavior
It is not possible to run custom replacements on JavaScript from a transformer.
💁 Possible Solution
Make it possible to run custom replacements on JavaScript from a transformer.
To be more serious: right now, only the JS transformer has the ability to run said replacements, so I think adding a meta property for custom replacement keys and values should make this possible.
🔦 Context
Support Vue's runtime globals from the Vue transformer as mentioned in this comment.
The text was updated successfully, but these errors were encountered: