tx
用于esm.sh服务的 TSX 转接器,由 缩写。 。 。 .
使用量
import init, { transform } from "https://esm.sh/@esm.sh/tsx";
// load tsx_bg.wasm
await init();
const code = `
import { useState } from "react"
export default App() {
const [msg] = useState<string>("world")
return <h1>Hello {msg}!</h1>
}
`;
const importMap = {
imports: {
"react": "https://esm.sh/[email protected]",
"react/": "https://esm.sh/[email protected]/",
},
};
const ret = transform({ filename: "/App.tsx", code, importMap });
console.log(ret.code);
更多用户检查 类型/指数.d.ts。 。 。 .
开发设置
构建
wasm-pack build --target web --no-pack --release
运行测试
cargo test --all