-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Describe the bug
I try to get the typescript path aliases to work since it should be working right now on the 1.2.65 swc core version, am i doing something wrong ?
TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "@api" is not a valid package name imported from C:\Users\x\test\hello.js
at packageResolve (internal/modules/esm/resolve.js:601:11)
at moduleResolve (internal/modules/esm/resolve.js:691:18)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:805:11)
at Loader.resolve (internal/modules/esm/loader.js:88:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:241:28)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:72:40)
at link (internal/modules/esm/module_job.js:71:36) {
code: 'ERR_INVALID_MODULE_SPECIFIER'
}
Input code
api.ts
export const api = 0;hello.ts
import { api } from '@api';
console.log('api', api);Tsconfig
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@api": ["src/api"]
}
}
}Config
{
"jsc": {
"parser": {
"syntax": "typescript",
"dynamicImport": true
},
"target": "es2016",
"paths": {
"@api": ["src/api"]
}
},
"minify": false
}Expected behavior
It should replace the alias with a relative path
Version
1.2.65
narcisbugeag, yannbcf, Stuyk, marvinroger, mehrangta and 1 more