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

tsconfig-paths has stuck when run with ts-node with tsconfig.json #267

Open
nhatdn opened this issue May 13, 2024 · 0 comments
Open

tsconfig-paths has stuck when run with ts-node with tsconfig.json #267

nhatdn opened this issue May 13, 2024 · 0 comments

Comments

@nhatdn
Copy link

nhatdn commented May 13, 2024

old configs

{
  "compilerOptions": {
    "sourceMap": true,
    "baseUrl": ".", 
    "paths": {
      "@/*": ["src/*"]
    },
    "moduleResolution": "Node",
    "outDir": "./dist",
    "alwaysStrict": true,
    "noImplicitAny": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strict": true,
    "module": "ESNext",
    "target": "es5",
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "rootDirs": ["src"],
    "types": ["node", "jest", "express"]
  },
  "include": ["src/**/*.ts"],
  "exclude": ["node_modules"],
  "ts-node": {
    "experimentalSpecifierResolution": "node",
    "transpileOnly": true,
    "esm": true,
    "require": ["tsconfig-paths/register"]
  },
}

This is a solution (install tsnode latest) and config tsconfig.json file:

{
  "compilerOptions": {
    "sourceMap": true,
    "baseUrl": ".", 
    "paths": {
      "@/*": ["src/*"]
    },
    "moduleResolution": "NodeNext",
    "outDir": "dist",
    "alwaysStrict": true,
    "noImplicitAny": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strict": true,
    "module": "NodeNext",
    "target": "ES2022",
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "rootDirs": ["src"],
    "types": ["node", "jest", "express"]
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"],
  "ts-node": {
    "experimentalSpecifierResolution": "node",
    "transpileOnly": true,
    "esm": false,
    "require": ["tsconfig-paths/register"]
  },
}

refer: Van Bao developer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant