-
Notifications
You must be signed in to change notification settings - Fork 1.4k
swc-plugin option overrideIdFn
does not provide the same filepath as the babel-plugin
#3375
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
Comments
That's a swc problem unfortunately. How are you running your swd pipeline? |
Through webpack with the swc-loader |
yeah that seems like a swc-loader issue |
Correct me if I'm wrong, but it seems like inside the FormatTransformer, the way it's resolving the filename is just by taking the passed in option and if nothing is passed in, it just defaults to an empty string -> https://github.com/formatjs/formatjs/blob/main/packages/swc-plugin/src/transform.ts#L592 If that is the case, it doesn't seem like swc-loader issue |
Yeah but it's supposed to be passed in is the problem. Babel-loader passes it in |
Okay, do you have any suggestions on how to get around this? I'm not sure swc will add that feature |
No I don't unfortunately. For reference |
I've opened a bug with swc-loader swc-project/swc-loader#36 to help address this |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Which package?
swc-plugin
Describe the bug
In the swc-plugin there is an option for
overrideIdFn
, I recently opened a PR to add the filename as the 4th arg to match how the babel-plugin behaves, but it turns out that in the swc-plugin, the filename is just an empty string''
or the providedoption.fileName
, whereas in the babel-plugin the fileName passed to overrideIdFn is the actual file path of thevisitor
. So for projects that try to migrate from babel to swc, this is a breaking because it's not behaving the same way and there is no workaround as far as i can tellTo Reproduce
Reproducible Steps/Repo
Steps to reproduce the behavior:
overrideIdFn
with a callback with 4 argsExpected behavior
The 4th arg to
overrideIdFn
should be the filename of the file holding the messagem not the filename passed in as option to swc-pluginDesktop (please complete the following information):
The text was updated successfully, but these errors were encountered: