Major: use swc-loader for TypeScript compilation#777
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.
@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.
@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
swcdoesn't perform type checking, only compilation of TS to JSTODO: remove
transpileOnlyflag since it is always true now