rollup-plugin-swc
rollup-plugin-swc copied to clipboard
Deno
Hi, is there an option to swap the SWC internal with wasm version instead of the default node addon?
Something like
import { rollup } from "npm:rollup"
import { swc } from "npm:rollup-plugin-swc3"
const build = await rollup({
input: ["main.ts", "lib.mts"],
plugins: [
swc({
wasm: "https://esm.sh/@swc/wasm-web/wasm_bg.wasm"
}),
],
})
await build.write({ dir: "dist", format: "es" })
Just got an error with the default one since Deno doesn't support Node native addons
Error: Failed to convert napi value into rust type `Option<T>`
at Compiler.<anonymous> (file:///home/wildan/.cache/deno/npm/registry.npmjs.org/@swc/core/1.3.24/index.js:216:33)
at (file:///home/wildan/.cache/deno/npm/registry.npmjs.org/@swc/core/1.3.24/index.js:34:71)
at __awaiter (file:///home/wildan/.cache/deno/npm/registry.npmjs.org/@swc/core/1.3.24/index.js:30:12)
at Compiler.transform (file:///home/wildan/.cache/deno/npm/registry.npmjs.org/@swc/core/1.3.24/index.js:202:16)
at transform (file:///home/wildan/.cache/deno/npm/registry.npmjs.org/@swc/core/1.3.24/index.js:344:21)
at Object.transform (file:///home/wildan/.cache/deno/npm/registry.npmjs.org/rollup-plugin-swc3/0.8.0/dist/index.mjs:129:20)
at (file:///home/wildan/.cache/deno/npm/registry.npmjs.org/rollup/3.9.1/dist/es/shared/rollup.js:23660:40)
Hi, is there an option to swap the SWC internal with wasm version instead of the default node addon?
I am still figuring out how to fallback from @swc/core to @swc/wasm.
Generally, I'd prefer @swc/core whenever possible. @swc/core is significantly faster than @swc/wasm.
I've done some experiment to integrate @swc/wasm with es-module-shims in the past.
Hope that can help.
Hi, is there an option to swap the SWC internal with wasm version instead of the default node addon?
I am still figuring out how to fallback from
@swc/coreto@swc/wasm.Generally, I'd prefer
@swc/corewhenever possible.@swc/coreis significantly faster than@swc/wasm.
There is a hack: map @swc/core to @swc/wasm in deno's import map.