swc/wasm/__tests__/simple.js
Donny/강동윤 e5f46a6800
fix(wasm): Fix bugs (#2279)
swc:
 - Ensure that #2281 is fixed. (#2281)

wasm:
 - Fix `baseUrl` and `paths` support.
 - Apply `hygiene` pass.
2021-09-21 15:24:03 +00:00

34 lines
610 B
JavaScript

const swc = require("../pkg");
it("should be loadable", function () {
const output = swc.transformSync("class Foo {}", {});
});
it("should support 'paths' and 'baseUrl'", async () => {
const { code } = await swc.transformSync(`
import foo from '@src/app';
console.log(foo)
`, {
filename: 'main.js',
jsc: {
parser: {
syntax: 'typescript',
},
target: 'es2021',
transform: {
},
baseUrl: __dirname,
paths: {
'@src/*': ['bar/*']
}
},
module: {
type: 'commonjs'
},
});
expect(code).toContain(`bar/app`);
})