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

Compatibility with moduleResolution: "Node16" is broken. #1160

Closed
ivands opened this issue Dec 14, 2022 · 3 comments
Closed

Compatibility with moduleResolution: "Node16" is broken. #1160

ivands opened this issue Dec 14, 2022 · 3 comments

Comments

@ivands
Copy link

ivands commented Dec 14, 2022

Sadly superstruct isn't compatible with the new module resolution algo.
Should be fixed to be compatible in the future.

@bdr99
Copy link

bdr99 commented Jan 26, 2023

I spent some time looking into this issue, and I think it's caused by the missing .js extension on the generated index.d.ts type definitions file.

Here are the current contents of index.d.ts:

export * from './error';
export * from './struct';
export * from './structs/coercions';
export * from './structs/refinements';
export * from './structs/types';
export * from './structs/utilities';
//# sourceMappingURL=index.d.ts.map

If I modify the file to look like this, then the issue is resolved.

export * from './error.js';
export * from './struct.js';
export * from './structs/coercions.js';
export * from './structs/refinements.js';
export * from './structs/types.js';
export * from './structs/utilities.js';
//# sourceMappingURL=index.d.ts.map

@ianstormtaylor, is there a way we can configure the build process so that it includes the .js extension?

@arv
Copy link

arv commented Feb 21, 2023

One solution is to change the tsconfig to use "moduleResolution": "node16" in tsconfig.json and then fix the import paths. This is pretty easy to do and I did this locally...

But... (isn't there always a but)... the tool babel/register which is used by npm run test does not support moduleResolution: node16 because it cannot find the file index.js. This all makes sense. I think another tool needs to be used for the test.

@arturmuller
Copy link
Collaborator

Closing in this favour of #1200 (it is currently my priority to fix this).

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

4 participants