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

ERR_IMPORT_ASSERTION_TYPE_MISSING in newer Node.js versions #26

Open
aral opened this issue May 2, 2023 · 1 comment
Open

ERR_IMPORT_ASSERTION_TYPE_MISSING in newer Node.js versions #26

aral opened this issue May 2, 2023 · 1 comment

Comments

@aral
Copy link

aral commented May 2, 2023

Sadly, newer versions of Node.js (version v17.5.0+) require an additional hoop to jump through to import JSON files.

The error raised is:

[ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "…/node_modules/currency-format/currency-format.json" needs an import assertion of type "json"

More information: https://v8.dev/features/import-assertions

@aral
Copy link
Author

aral commented May 2, 2023

Ah, my bad, I didn’t see that the main export is the JSON file :)

In which case, make sure you import currency-format like this:

import currencyFormat from 'currency-format' assert {type: 'json'}

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