-
Notifications
You must be signed in to change notification settings - Fork 293
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
Major: use swc-loader
for TypeScript compilation
#777
base: main
Are you sure you want to change the base?
Conversation
swc-loader
for typescript compilation
swc-loader
for typescript compilationswc-loader
for TypeScript compilation
@guybedford @sokra @kdy1 @huozhi Any thoughts on how to solve this one?
Now the JS integration tests pass but the TS ones fail with the following:
|
It seems like node failed to resolve But I'm not sure about the reason, as I found |
keepClassNames: true, | ||
target: compilerOptions.target && compilerOptions.target.toLowerCase() || 'es2021', | ||
paths: compilerOptions.paths, | ||
baseUrl: compilerOptions.baseUrl, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kdy1 The paths
and baseUrl
tests are failing with:
panicked at 'failed to get current directory: Error { kind: Unsupported, message: "operation not supported on this platform" }', /home/runner/work/swc/swc/ecmascript/transforms/module/src/path.rs:81:56
Stack:
Error:
at u.exports.__wbg_new_59cb74e423758ede (dist/ncc/loaders/swc-loader.js.cache.js:1:2692)
at null.<anonymous> (wasm://wasm/04480186:0:15193164)
at null.<anonymous> (wasm://wasm/04480186:0:16752724)
at null.<anonymous> (wasm://wasm/04480186:0:16566604)
at null.<anonymous> (wasm://wasm/04480186:0:16677644)
at null.<anonymous> (wasm://wasm/04480186:0:16749249)
at null.<anonymous> (wasm://wasm/04480186:0:16736138)
at null.<anonymous> (wasm://wasm/04480186:0:16687572)
at null.<anonymous> (wasm://wasm/04480186:0:5322716)
at null.<anonymous> (wasm://wasm/04480186:0:15233495)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kdy1 The new @swc/wasm
no longer panics, but it still fails with very strange behavior.
Input:
https://github.com/vercel/ncc/blob/main/test/unit/tsconfig-paths/input.ts
import module from "@module";
console.log(module);
Output:
/******/ var __webpack_modules__ = ({
/***/ 105:
/***/ ((module) => {
module.exports = eval("require")("../../../../../../../../.././module");
/***/ })
/******/ });
Runtime result:
Error: Cannot find module '../../../../../../../../.././module'
Now that swc is extensively used at vercel, swc support in ncc would be hugely beneficial. |
This is a major change since
swc
doesn't perform type checking, only compilation of TS to JSTODO: remove
transpileOnly
flag since it is always true now