-
-
Notifications
You must be signed in to change notification settings - Fork 75
feat: use swc rather than workers by default #289
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
Conversation
Users will also need to configure their swcrc settings which for many users they have no idea what that is. Perhaps auto-generate sane values from tsconfig? |
Does swc work well with node packages? AFAIK, it's only for browser targets. |
The compiled output from swc can be used both in node and in the browser. |
Note, this is more of an RFC - it will be a serious project and needs an owner, probably not me. |
There's already some decent-looking code here to generate the swcrc from a tsconfig |
Some caveats of using SWC that warrant consideration if this to become a default:
export {A, B} from "./index";
// is A going to exist at runtime?
// is B? This is "breaking" because if SWC emits an import for a symbol that doesn't exist in the corresponding file, that will break downstream in bundling or loading the module via Node.
As a side note, I wonder what % of |
Perhaps the recommended pattern for ts_projects behind linked npm_packages should be to creates a runtime |
I considered that, but it seemed too much boilerplate as then all the deps need to be duplicated to list the |
I could see an npm_package_pair rule of sorts that handles the boilerplate |
I think our next step here can be to make rules_ts depend on the 1.0 of rules_swc (hopefully this week) and then improve the ease of choosing swc as the transpiler, maybe by making it possible to use Then document this as a preferred path and respond to issues users are running into. Then we'll be able to evaluate whether we've made it convenient enough to become the default sometime. This plan doesn't relieve pressure on making the persistent workers more hermetic and correct though. |
Useful as part of aspect-build/rules_ts#289 to make a migration path easier for those using tsc for transpiling
Useful as part of aspect-build/rules_ts#289 to make a migration path easier for those using tsc for transpiling
Useful as part of aspect-build/rules_ts#289 to make a migration path easier for those using tsc for transpiling
Useful as part of aspect-build/rules_ts#289 to make a migration path easier for those using tsc for transpiling
picking this back up with a fresh PR, new plan is just to force users to pick a default transpiler like we did for skipLibCheck |
I think we might be able to roll this out in a 1.x release. If we get good compatibility, it should only be breaking in that WORKSPACE needs swc dep/toolchain added. Bzlmod users (all zero of them) would be unaffected.