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

support using in ESM #9

Merged
merged 1 commit into from
May 21, 2024
Merged

support using in ESM #9

merged 1 commit into from
May 21, 2024

Conversation

asharpe
Copy link

@asharpe asharpe commented May 20, 2024

Node of some version requires hints to import JSON, otherwise you see

TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///workspaces/domain-info/node_modules/tlds/index.json" needs an import attribute of type "json"

This just adds the attribute. It should be fine for node>=18 as already specified.

@silverwind
Copy link
Owner

Interesting, I wasn't aware that tlds is a json module, but in fact, it is:

https://github.com/stephenmathieson/node-tlds/blob/9cbfc2472c3b7f59b0dfa4979fabceff31f0cba4/package.json#L8

@silverwind silverwind merged commit cd9b5f9 into silverwind:master May 21, 2024
0 of 2 checks passed
silverwind added a commit that referenced this pull request May 21, 2024
* use babel parser, fix lint (silverwind)
* test node 22 (silverwind)
* Merge pull request #9 from asharpe/esm-import (silverwind)
* update deps (silverwind)
* support using in ESM (Andrew Sharpe)
@asharpe
Copy link
Author

asharpe commented May 22, 2024

FYI, the 10.0.0 release has undone the import flag!

@silverwind
Copy link
Owner

silverwind commented May 22, 2024

Hmm indeed, it must be vite removing the attributes. I wonder how to preserve.

@silverwind
Copy link
Owner

Don't want to investigate this right now, so I inlined the dependency in 10.0.1.

@silverwind
Copy link
Owner

It's a bug in vite, so I will leave the inlining until that is resolved.

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