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'
Still greatly appreciate this project, by the way! Massively enjoying and benefiting from proper ESM :+1:
Thanks, @jdalton!
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)
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!
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 https://github.com/standard-things/esm/commit/69273afa071745e10e3413ee9c4cdc436edfbe1d;
Update:
esm v3.2.11 is released :tada: