Skip to content

Typescript 5.5 - Error: module is a string value; #299

@markbrockhoff

Description

@markbrockhoff

Hi, I encountered the following error after updating from Typescript 5.4.5 to 5.5.2.

Whenever I run the build command I get this strange error message:

> nuxt-module-build build

ℹ Building my-module                                                                               6:10:15 PM
ℹ Cleaning dist directory: ./dist                                                                  6:10:15 PM

[6:10:15 PM]  ERROR  module is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram

  at Object.createProgram (node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/typescript.js:123997:15)
  at getDeclarations (node_modules/.pnpm/mkdist@1.5.1_typescript@5.5.2_vue-tsc@2.0.22_typescript@5.5.2_/node_modules/mkdist/dist/index.mjs:302:22)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async mkdist (node_modules/.pnpm/mkdist@1.5.1_typescript@5.5.2_vue-tsc@2.0.22_typescript@5.5.2_/node_modules/mkdist/dist/index.mjs:525:35)
  at async mkdistBuild (node_modules/.pnpm/unbuild@2.0.0_typescript@5.5.2_vue-tsc@2.0.22_typescript@5.5.2_/node_modules/unbuild/dist/index.mjs:927:22)
  at async _build (node_modules/.pnpm/unbuild@2.0.0_typescript@5.5.2_vue-tsc@2.0.22_typescript@5.5.2_/node_modules/unbuild/dist/index.mjs:1086:3)
  at async build (node_modules/.pnpm/unbuild@2.0.0_typescript@5.5.2_vue-tsc@2.0.22_typescript@5.5.2_/node_modules/unbuild/dist/index.mjs:945:5)
  at async Object.run (node_modules/.pnpm/@nuxt+module-builder@0.8.0_@nuxt+kit@3.12.2_magicast@0.3.4_rollup@4.18.0__nuxi@3.12.0_typescr_mlzbradpvbwn42jlyps562epy4/node_modules/@nuxt/module-builder/dist/chunks/build.mjs:43:5)
  at async runCommand (node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs:316:16)
  at async runCommand (node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs:307:11)

It looks like something might be wrong with the way the declarations are generated. I created a minimal reproduction using the nuxt module template as baseline: https://github.com/markbrockhoff/nuxt-module-template-bug-repro/tree/reproduce-ts-5.5-bug (Use branch reproduce-ts-5.5-bug)

To reproduce the issue you only need to install the dependencies and run pnpm prepack.

Any help narrowing this issue down would be appreciated, thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions