RFC-019: more target environments support #648
jerrykingxyz
started this conversation in
RFC
Replies: 1 comment 1 reply
-
|
I have a few concerns:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
let rspack support to compile for multiple environments, such as web, webworker, es5, browserslist and more
Motivation
even we support most features out of the box in rspack, but we still need to some swc compile configuration for custom result.
for example
etc...
Guide-level explanation
target config
like webpack target, we need to support more type of target
env.targetsin swc configWhen multiple targets are passed, then common subset of features will be used
Set target to false if none of the predefined targets from the list above meet your needs, no plugins will be applied.
swc config
even though the
targetabove can control ouput result, we still need to some swc compile configuration for custom result. we can wrap and expose some swc param inbuiltinsReference-level explanation
target config
sequenceDiagram participant user participant node participant node_binding participant rspack user->>node: userConfig Note right of user: { target: string[] | string | false, builtins } node->>node_binding: rspackConfig Note right of node: { target: string[], builtins } node_binding->>rspack: compilerOption Note right of node_binding: struct target { platform, es_version } & enumswc config
sequenceDiagram participant user participant node participant node_binding participant rspack user->>node: userConfig Note right of user: { builtins: { polyfill, minify } } node->>node_binding: rspackConfig Note right of node: { builtins: { polyfill, minify, browserslist } } Note right of node: browserslist is read from project browserslist config node_binding->>rspack: compilerOption Note right of node_binding: enum builtins { polyfill, minify, browserslist }because of swc does not support reading browserslist config from
.browserslistrc&package.json(more info), we will use browserslist to load config in node and pass intobuiltins.browserslistThe first stage
in this stage, we will
targetconfigThe scond stage
in this stage, we will
builtins.swcconfigDrawbacks
Nope
Prior art
Nope
Unresolved questions
Nope
Future possibilities
Nope
Beta Was this translation helpful? Give feedback.
All reactions