ts-node меняет файл tsconfig.json - PullRequest
0 голосов
/ 14 мая 2019

Я создаю веб-приложение, используя Next.js и TypeScript.У меня есть пользовательский файл server.ts.Из-за этого моя команда разработки - ts-node server.ts.Все работало нормально, до сих пор :( Каждый раз, когда я пытаюсь запустить команду, мой файл tsconfig.json изменяется.

Я уже пробовал самые основные решения, такие как удаление каталога node_modules и запусккоманда npm install снова или переустановка всего Node.js. К сожалению, у меня ничего не получилось.

Вот мой файл tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "target": "es2017",
    "module": "esnext",
    "jsx": "preserve",
    "allowJs": true,
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "removeComments": false,
    "preserveConstEnums": true,
    "sourceMap": true,
    "skipLibCheck": true,
    "baseUrl": ".",
    "typeRoots": [
      "./types",
      "./node_modules/@types"
    ],
    "lib": [
      "dom",
      "esnext"
    ],
    "outDir": "dist/",
    "incremental": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true
  },
  "include": [
    "pages/*",
    "components/*",
    "server.ts"
  ],
  "exclude": [
    "node_modules",
    "**/*.spec.ts",
    "**/*.spec.tsx",
    "**/*.test.ts",
    "**/*.test.tsx",
    "jest.config.js",
    "jest.setup.js",
    "next.config.js"
  ]
}

А вот и сообщение Iполучаю после запуска ts-node server.ts:

The following changes are being made to your tsconfig.json file:
  - compilerOptions.strict to be suggested value: true (this can be changed)
  - compilerOptions.forceConsistentCasingInFileNames to be suggested value: true (this can be changed)
  - compilerOptions.esModuleInterop must be true (requirement for babel)
  - compilerOptions.module must be esnext (for dynamic import() support)
  - compilerOptions.resolveJsonModule must be true
  - compilerOptions.isolatedModules must be true (requirement for babel)
  - compilerOptions.noEmit must be true

1 Ответ

1 голос
/ 15 мая 2019

Хорошо, я наконец-то нашел проблему. Похоже, что автоматическая установка TypeScript была добавлена ​​в Next.js v8.1.1.canary.26 ( pull request ). Тем не менее, похоже, что он не всегда работает правильно. Уже существует проблема , связанная с этой новой функцией.

...