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

Add mapping of tsconfig compiler option 'moduleResolution' #2616

Merged
merged 2 commits into from
Aug 10, 2023

Conversation

emilhe
Copy link
Contributor

@emilhe emilhe commented Aug 10, 2023

This PR adds a mapping of tsconfig compiler option moduleResolution from string representation to the appropriate enum representation. Currently, if you set the moduleResolution option intsconfig.json to one of the allowed values ('node', 'classic', 'node16', 'nodenext'), e.g.

{
  "compilerOptions": {
    "moduleResolution": "node",
    ...
  },
  ...
}

you will get an error like,

> dash-generate-components ./src/ts/components tsconvert -p package-info.json --r-prefix '' --jl-prefix '' --ignore \.test\.

/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:2572
            throw e;
            ^

Error: Debug Failure. Unexpected moduleResolution: node
    at Object.resolveModuleName (/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:44046:37)
    at loader_1 (/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:119377:117)
    at loadWithModeAwareCache (/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:118997:46)
    at actualResolveModuleNamesWorker (/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:119378:149)
    at resolveModuleNamesWorker (/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:119667:26)
    at resolveModuleNamesReusingOldState (/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:119765:24)
    at processImportedModules (/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:121296:35)
    at findSourceFileWorker (/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:121076:17)
    at findSourceFile (/home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:120922:26)
    at /home/emher/Code/tsconvert/node_modules/typescript/lib/typescript.js:120871:85

Node.js v18.16.1

Error generating metadata in tsconvert (status=1)

This PR fixes this issue. The PR builds on dicussions from this thread.

Copy link
Contributor

@T4rk1n T4rk1n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you @emilhe. Just need to add a changelog entry.

@emilhe
Copy link
Contributor Author

emilhe commented Aug 10, 2023

Thanks! I have added a changelog entry now.

Copy link
Contributor

@T4rk1n T4rk1n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃

@T4rk1n T4rk1n merged commit b4ba117 into plotly:dev Aug 10, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants