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

CLI does not support tsconfig with comments #730

Closed
yanniz0r opened this issue Aug 10, 2020 · 0 comments
Closed

CLI does not support tsconfig with comments #730

yanniz0r opened this issue Aug 10, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@yanniz0r
Copy link

Describe the bug
By default, initializing a project with tsc --init creates a tsconfig file with a lot of comments inside. I usually leave them in. If you run the cli method yarn mikro-orm cache:generate runs into an error when comments are present.

Stack trace

(node:8435) UnhandledPromiseRejectionWarning: SyntaxError: /Users/*****/Project/Private//*****/tsconfig.json: Unexpected token/ in JSON at position 259
    at parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:1234:22)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Function.registerTsNode (/Users//*****/Project/Private//*****d/node_modules/@mikro-orm/core/utils/ConfigurationLoader.js:57:30)
    at Function.configure (/Users//*****/Project/Private/*****/node_modules/@mikro-orm/cli/CLIHelper.js:38:13)
    at /Users//*****/Project/Private//*****/node_modules/@mikro-orm/cli/cli.js:16:1

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project and initialize it with tsc --init
  2. Add mikro orm cli and bootstrap the app with database connection etc.
  3. run yarn mikro-orm cache:generate

Expected behavior
Either should the error be more clear, something like The provided tsconfig is invalid. Please keep in mind that comments are not allowed or it should support comments.

Additional context
A tsconfig that allows reproduction of the issue looks like this:

{
  "compilerOptions": {
    "target": "ES2017",
    "module": "commonjs",
    "outDir": "./dist",
    "strict": true,
    "baseUrl": "./src",
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true
  }
}
/** Test */

Versions

Dependency Version
node 14.4.0
typescript 3.9.6
mikro-orm 4.0.0-rc.0
your-driver pg
@yanniz0r yanniz0r added the bug Something isn't working label Aug 10, 2020
@B4nan B4nan closed this as completed in 6506695 Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants