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

Unable to override tsconfig.compilerOptions.moduleResolution #1168

Open
zemse opened this issue Feb 15, 2023 · 1 comment
Open

Unable to override tsconfig.compilerOptions.moduleResolution #1168

zemse opened this issue Feb 15, 2023 · 1 comment

Comments

@zemse
Copy link

zemse commented Feb 15, 2023

Current Behavior

If I want to use moduleResolution as node16, currently tsdx ignores what is specified in tsconfig and uses legacy module resolution. This causes typescript errors.

The particular feature that I want to use is package.json exports. For this to work, the moduleResolution should be set to node16. By setting this, typescript errors in vscode disappear, however tsdx build does not succeed (and the error that it gives is similar to what vscode gives without node16 moduleResolution).

Example error:

(typescript) Error: /my/project/src/file/path.ts(5,34): semantic error TS2307: Cannot 
find module 'ethers/address' or its corresponding type declarations.

Here, ethers is a package, and address is defined as an export in it's package.json.

Expected behavior

It should build.

Suggested solution(s)

Additional context

Your environment


  System:
    OS: macOS 12.0.1
    CPU: (8) arm64 Apple M1
    Memory: 134.91 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.17.1/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.1/bin/npm
  Browsers:
    Chrome: 109.0.5414.119
    Firefox: 89.0.1
    Safari: 15.1
  npmPackages:
    tsdx: ^0.14.1 => 0.14.1 
    typescript: ^4.6.3 => 4.8.3 
  npmGlobalPackages:
    typescript: 4.8.4
@zemse
Copy link
Author

zemse commented Feb 15, 2023

It seems this issue is caused in rollup-plugin-typescript2. The user's tsconfig is overridden and moduleResolution is set to legacy node resolution (relevant code).

I've locally tried to patch this. However, the build gets stuck forever. There may be a reason why this is overridden.

I've created an upsteam issue ezolenko/rollup-plugin-typescript2#437.

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