(WIP) RFC-022: support swc plugin #733
jerrykingxyz
started this conversation in
RFC
Replies: 2 comments
-
define also need to be put into builtins because webpack doesn't support this out of box |
Beta Was this translation helpful? Give feedback.
0 replies
-
How to deal with the conflict problem that the version of crate |
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
-
Summary
how to use swc plugin in rspack
Motivation
the swc cannot satisfy custom transform feature, we need load some custom swc plugin to extension swc feature.
the custom plugin can from rspack or third-party like swc plugin which shared with modernjs
Prior art
how to use swc plugin
there two way to use swc plugin
jsc.experimental.plugins
. more infothis is official way to create swc plugin, it can dymantic install and use plugin. because of using wasm, the running speed is much better than js.
this is the fastest way to use swc plugin, but it will make rspack larger
because of performance, we decided to use swc plugin in rspack and expose configurable options to control it.
Guide-level explanation
rspack swc plugin
the rspack swc plugin is officially developed and maintained by us, and its switches are in the rspack configuration file
third-party swc plugins
the third-party plugin need change rspack code to support
Reference-level explanation
rspack swc plugin
visitors
foldervisitor
are inmod.rs
, and it expose those functionsbefore_pass
after_pass
scan_dependency
third-party swc plugins
builtins.xxx
as config paramTODO
visitors
in current code, make it all inmod.rs
Drawbacks
Beta Was this translation helpful? Give feedback.
All reactions