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

Import packge.json (using esm) #547

Closed
vashian opened this issue Nov 2, 2022 · 1 comment
Closed

Import packge.json (using esm) #547

vashian opened this issue Nov 2, 2022 · 1 comment

Comments

@vashian
Copy link

vashian commented Nov 2, 2022

Do you want to request a feature or report a bug?

This is a bug report

What is the current behavior?

using oclif with esm and need to import package.json
running the command: oclif manifest and here's the output error:

mycli: Module 
    "file:///path/package.json" needs an import 
    assertion of type "json"
    Code: ERR_IMPORT_ASSERTION_TYPE_MISSING

but after following the instruction and import packge.json like this:

import pkg from '../package.json' assert { type: 'json' };

then I've got a warning:
ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time

OS: Ubuntu 22.04.1 LTS x86_64
@oclif/core: 1.13.10

@RodEsp
Copy link
Contributor

RodEsp commented Nov 2, 2022

Hi @vashian, I don't think this issue is related to oclif but feel free to re-open this issue if I'm incorrect.

Both the error and the warning you're describing come directly from nodejs. Which version of nodejs are you using? Node didn't start supporting importing JSON files as modules until version 17.1.0.

See (these docs](https://nodejs.org/docs/latest-v19.x/api/esm.html#json-modules) for more info about the warning.

@RodEsp RodEsp closed this as completed Nov 2, 2022
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

2 participants