Navigation Menu

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

SyntaxError in 3.2.10: The requested module 'file:///<path>package.json' does not provide an export named '<export>' #735

Closed
oles opened this issue Mar 4, 2019 · 4 comments

Comments

@oles
Copy link

oles commented Mar 4, 2019

import {_moduleAliases as alias} from './package.json'

Worked in 3.2.9 - but it seems like all json files are broken now:

import packageJSON from './package.json'
results in
SyntaxError: The requested module 'file:///<path>/package.json' does not provide an export named 'default'

@oles
Copy link
Author

oles commented Mar 4, 2019

Still greatly appreciate this project, by the way! Massively enjoying and benefiting from proper ESM 👍
Thanks, @jdalton!

@oles oles changed the title SyntaxError in 3.2.10: The requested module 'file:///<path>package.json' does not provide an export named '<export>'' SyntaxError in 3.2.10: The requested module 'file:///<path>package.json' does not provide an export named '<export>'" Mar 4, 2019
@oles oles changed the title SyntaxError in 3.2.10: The requested module 'file:///<path>package.json' does not provide an export named '<export>'" SyntaxError in 3.2.10: The requested module 'file:///<path>package.json' does not provide an export named '<export>' Mar 4, 2019
@dnalborczyk
Copy link
Contributor

dnalborczyk commented Mar 4, 2019

hey @oles thank you for reporting!

could you give some simple repro steps or create a repro repository? I tried to replicate both of your cases, but both worked as expected (with node v11.10.1/macOS)

@oles
Copy link
Author

oles commented Mar 4, 2019

Narrowed it down:

package.json

{
    "devDependencies": {
        "esm": "3.2.10",
        "module-alias": "2.1.0"
    }
}

index.js

import packageJSON from './package.json'

console.log(packageJSON)

Running node -r esm -r module-alias/register index.js results in the error,
but node -r esm index.js works!

With version 3.2.9 however - both work!

@jdalton
Copy link
Member

jdalton commented Mar 4, 2019

Thanks @oles!

We migrated JSON to a different module type. I'll add a json test to our mock tests and add module-alias scenario too.

Update:

Patch 69273af;

Update:

esm v3.2.11 is released 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants