Authoring plugins to automatically add imports #1378
Unanswered
JoviDeCroock
asked this question in
Q&A
Replies: 1 comment
-
Hi i was playing with an swc plugin to rewrite imports paths.
Instead of passing a handmade tree, i'd try to get a new tree out of swc.parse() and pluck it in the right place.
That's related to a0898e8 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey all,
Loving the swc-project, was wondering whether or not it's possible to create plugins that add imports, for instance when someone uses JSX we can automatically add that import, ...
I made an example:
However this seems to always fail with the message that we are missing the span attributes
Is there a way to automatically generate these or is this purposely unsupported.
Another issue I'm running into (Disclaimer using this through rollup) is that when doing multiple files concurrently the plugin doesn't seem to fire when using it like this:
plugin: m => new JSXImportAppender().visitProgram(m),
Relevant PR: https://github.com/preactjs/wmr/pull/321/files#r571402713
Beta Was this translation helpful? Give feedback.
All reactions