mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
e5f46a6800
swc: - Ensure that #2281 is fixed. (#2281) wasm: - Fix `baseUrl` and `paths` support. - Apply `hygiene` pass.
34 lines
610 B
JavaScript
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`);
|
|
})
|