Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

repro misleading error messages #768

Closed
dnalborczyk opened this issue Mar 27, 2019 · 3 comments
Closed

repro misleading error messages #768

dnalborczyk opened this issue Mar 27, 2019 · 3 comments

Comments

@dnalborczyk
Copy link
Contributor

dnalborczyk commented Mar 27, 2019

repro for error message case which --experimental-modules seems to be more specific about:

// index.js
import { ControllerA } from "./controllers/index.js"
// /controllers/index.js
export { default as ControllerA } from "./ControllerA.js"
// /controllers/ControllerA.js
export {}

esm:

node -r esm index.js
SyntaxError: The requested module 'file:///Users/daniel/dev/repros/esm/error-prop/controllers/index.js' does not provide an export named 'ControllerA'
    at internal/main/run_main_module.js:21:11

--experimental modules:

node --experimental-modules index.mjs
(node:3693) ExperimentalWarning: The ESM module loader is experimental.
file:///Users/daniel/dev/repros/esm/error-prop/controllers/index.mjs:1
export { default as ControllerA } from "./ControllerA.mjs";
         ^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module './ControllerA.mjs' does not provide an export named 'default'
    at ModuleJob._instantiate (internal/modules/esm/module_job.js:88:21)

to be more specific:
esm: The requested module 'file:///Users/daniel/dev/repros/esm/error-prop/controllers/index.js' does not provide an export named 'ControllerA'
vs:
--exp mod: The requested module './ControllerA.mjs' does not provide an export named 'default'

when you compare the two above, --experimental-modules points out directly where and what is wrong. with esm you [kinda] don't know.

@jdalton jdalton added the bug label Mar 27, 2019
@jdalton
Copy link
Member

jdalton commented Mar 27, 2019

Thanks @dnalborczyk!

I've got a fix for this locally.

Update:

Patch 25a5b78

@dnalborczyk Would you be up for adding a test?

@dnalborczyk
Copy link
Contributor Author

Would you be up for adding a test?

@jdalton yeah, will look into it!

@jdalton
Copy link
Member

jdalton commented Mar 29, 2019

esm v3.2.21 is released 🎉

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

No branches or pull requests

2 participants