Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@swc-node/register v1.5.6 breaking module aliases transpilation where in v1.5.4 works great #687

Closed
g-wozniak opened this issue Feb 9, 2023 · 2 comments · Fixed by #688
Assignees
Labels
bug Something isn't working

Comments

@g-wozniak
Copy link

Having updated @swc-node/register to v1.5.6 SWC stopped transpiling module aliases where the exact same setup works without issues for v1.5.4.

Structure:

  • src/app.ts
  • src/properties.ts

My app.ts:

import {LogCategories} from '@root/properties'
console.log(LogCategories.dummy)

My properties.ts:

export enum LogCategories = {
   dummy = 'dummy'
}

My tsconfig.json:

{
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./.build",
    "target": "ES2021",
    "esModuleInterop": true,
    "paths": {
      "@root/*": ["src/*"]
    },
    "moduleResolution":"node"
  },
  "exclude": [
    "node_modules"
  ]
}

My .swcrc:

{
  "test": ".ts$",
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false,
      "decorators": false,
      "dynamicImport": true
    },
    "target": "es2021"
  },
  "module": {
    "type": "commonjs"
  }
}

My execution command:
node --inspect=7777 -r @swc-node/register ./src/app.ts

Error message I am getting in 1.5.6:
Error: Cannot find module '@root/properties'

Other dependencies:

  • "@swc/cli": "^0.1.57",
  • "@swc/core": "^1.3.14",
  • "typescript": "^4.8.4"

Have you encountered similar issue or able to advise what may cause it?

@Brooooooklyn Brooooooklyn self-assigned this Feb 10, 2023
@Brooooooklyn Brooooooklyn added the bug Something isn't working label Feb 10, 2023
@Brooooooklyn
Copy link
Member

Maybe relate with: swc-project/swc#6930

@g-wozniak
Copy link
Author

@Brooooooklyn Sorry, forgot to mention, it's Mac OS, WebStorm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants