diff --git a/e2e/js/src/js-swc.test.ts b/e2e/js/src/js-swc.test.ts index d1edd859410fc3..e9dc8087b8b372 100644 --- a/e2e/js/src/js-swc.test.ts +++ b/e2e/js/src/js-swc.test.ts @@ -135,7 +135,7 @@ export function x() { // update .swcrc to use path mappings updateJson(`libs/${lib}/.swcrc`, (json) => { json.jsc.paths = { - 'src/*': ['src/*'], + '~/*': ['src/*'], }; return json; }); @@ -144,7 +144,7 @@ export function x() { updateFile(`libs/${lib}/src/lib/${lib}.ts`, () => { return ` // @ts-ignore -import { x } from 'src/x'; +import { x } from '~/x'; export function myLib() { console.log(x()); @@ -154,8 +154,8 @@ myLib(); `; }); - // now run build - runCLI(`build ${lib}`); + // now run build without type checking (since we're using path mappings not in tsconfig) + runCLI(`build ${lib} --skipTypeCheck`); // invoke the lib with node const result = execSync(`node dist/libs/${lib}/src/lib/${lib}.js`, { diff --git a/packages/js/src/executors/swc/swc.impl.ts b/packages/js/src/executors/swc/swc.impl.ts index 4bb1a4056081dd..b371564ba4936c 100644 --- a/packages/js/src/executors/swc/swc.impl.ts +++ b/packages/js/src/executors/swc/swc.impl.ts @@ -76,7 +76,7 @@ export function normalizeOptions( swcrcContent.jsc.paths && !swcrcContent.jsc.baseUrl ) { - swcrcContent.jsc.baseUrl = `./${projectDir}`; + swcrcContent.jsc.baseUrl = `.`; swcrcPath = getSwcrcPath(options, contextRoot, projectRoot, true); writeJsonFile(swcrcPath, swcrcContent); } diff --git a/packages/js/src/utils/swc/compile-swc.ts b/packages/js/src/utils/swc/compile-swc.ts index aa441ad9f8dd61..61edec414dc431 100644 --- a/packages/js/src/utils/swc/compile-swc.ts +++ b/packages/js/src/utils/swc/compile-swc.ts @@ -10,7 +10,7 @@ function getSwcCmd( { swcrcPath, srcPath, destPath }: SwcCliOptions, watch = false ) { - let swcCmd = `npx swc ${srcPath} -d ${destPath} --no-swcrc --config-file=${swcrcPath}`; + let swcCmd = `npx swc ${srcPath} -d ${destPath} --config-file=${swcrcPath}`; return watch ? swcCmd.concat(' --watch') : swcCmd; }