swc/node-swc/__tests__/paths_test.mjs
강동윤 ff47e2539e
fix(swc): Fix bugs (#1932)
swc_common:
 - Fix handling of input source map. (#1930)

swc:
 - Respect `paths`. (#1858)

node:
 - Fix typings of `paths`.
2021-07-17 11:16:00 +00:00

27 lines
524 B
JavaScript

import swc from "../..";
it("should respect paths", async () => {
const { code } = await swc.transform(`
import foo from '@src/app';
console.log(foo)
`, {
jsc: {
parser: {
syntax: 'typescript',
},
target: 'es2021',
transform: {
},
paths: {
'@src/*': ['bar/*']
}
},
module: {
type: 'commonjs'
},
});
expect(code).toContain(`bar/app`);
})