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

Access module specifier from thrown Error #416

Open
marklundin opened this issue Apr 10, 2024 · 1 comment
Open

Access module specifier from thrown Error #416

marklundin opened this issue Apr 10, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@marklundin
Copy link
Contributor

marklundin commented Apr 10, 2024

When importing a module that contains the following code, which throws a SyntaxError such as this.

import NoDefault from './invalid-module.js'

importShim would throw the error containing the blob url The requested module 'blob:https://xyzcom/df954a0e-1f96-4f52-8521-c2a32ea59bde' does not provide an export named 'default'.

Is there any way to retrieve the original path to the module './invalid-module' in the thrown error rather than the blob url?

@guybedford
Copy link
Owner

guybedford commented Apr 10, 2024

We could implement an ES Module Shims specific exports validation which could allow us to catch this earlier in the pipeline and throw a nicer error. It would have some overhead, but sounds like it would be the right approach here. While inspecting the blob URL does have a source URL, but browser debugging is not great here I know.

I don't have the bandwidth to work on a named exports validation and error phase, but will mark this as an enhancement for the project.

@guybedford guybedford added the enhancement New feature or request label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants