Skip to content

Default module name normalizer wrongfully assumes QJS libc/runtime environment #650

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

Closed
richarddd opened this issue Nov 6, 2024 · 4 comments · Fixed by #662
Closed

Default module name normalizer wrongfully assumes QJS libc/runtime environment #650

richarddd opened this issue Nov 6, 2024 · 4 comments · Fixed by #662

Comments

@richarddd
Copy link
Contributor

Hey,

I saw this PR introduced some backwards compatibility features in the default normalizer:
https://github.com/quickjs-ng/quickjs/pull/618/files#diff-45f1ae674139f993bf8a99c382c1ba4863272a6fec2f492d76d7ff1b2cfcfbe2R26271-R26279

This change introduces issue and potential bugs for users running only quickjs engine, but not runtime.

For instance if we register a "os" module in rquickjs and not using a custom normalizer we'll get warning about qjs prefix which is completely irrelevant.

Correct solution would be to to register a custom normalizer in quickjs-libc that handles this case, or ignore the backwards compatibility.

@saghul
Copy link
Contributor

saghul commented Nov 6, 2024

I did think of that but chose to "see what happens" since we'd basically need 99.9% the same normalizer, and since everyone uses namespaces imports I thought it should be fine...

@bnoordhuis
Copy link
Contributor

Maybe just revert that change? It's really only relevant for qjs (and maybe qjsc?), embedders can name modules whatever they want when they initialize them.

@saghul
Copy link
Contributor

saghul commented Nov 7, 2024

Let me try to move it to cutils so we can use it in both places.

If it feels wrong we can just revert.

@saghul
Copy link
Contributor

saghul commented Nov 8, 2024

I went with a revert: #662

saghul added a commit that referenced this issue Nov 8, 2024
bluesky950520 pushed a commit to bluesky950520/quickjs that referenced this issue Mar 14, 2025
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

Successfully merging a pull request may close this issue.

3 participants