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

Cannot import correctly under TypeScript Node 16 module resolution #752

Open
Jack-Works opened this issue Nov 5, 2022 · 4 comments
Open

Comments

@Jack-Works
Copy link

Jack-Works commented Nov 5, 2022

Under TypeScript Node 16 module resolution (has type: module in the package.json and moduleResolution: Node16 in tsconfig.json), this package cannot be imported correctly.

image

import ss from '@snapshot-labs/snapshot.js'

ss.Client
// error!
ss.default.Client

package.json

{ "type": "module" }

tsconfig.json

{
    "compilerOptions": {
        "moduleResolution": "Node16"
    }
}
@ChaituVR
Copy link
Member

@Jack-Works Are you still facing it? can share a sandbox-like env to reproduce?

@Jack-Works
Copy link
Author

Did you try my reproduction? It's very simple, you don't need a sandbox

@bam4564
Copy link

bam4564 commented Aug 29, 2023

Also running into this issue.

@ChaituVR
Copy link
Member

It works if i change it to "moduleResolution": "Node" or if you are using Node16, you may have to import it using require

var snapshot = require('@snapshot-labs/snapshot.js');

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

3 participants