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

Test if type=module is allowed for v2 addons #1466

Conversation

NullVoxPopuli
Copy link
Collaborator

@NullVoxPopuli NullVoxPopuli commented Jun 8, 2023

Noticed an issue with a development ember build and got this error with type=module in the package.json of the v2 addon:

Build Error (PackagerRunner) in ../node_modules/.pnpm/file+ember-primitives_@glimmer+component@1.1.2_@glimmer+tracking@1.1.2_@glint+template@1.0.2__5flicjnelbvasblmzhqljcm6ai/node_modules/ember-primitives/dist/index.js

Module not found: Error: Can't resolve '<repo>/node_modules/.pnpm/@embroider+macros@1.11.0_@glint+template@1.0.2/node_modules/@embroider/macros/src/addon/es-compat' in '$TMPDIR/embroider/2194b3/node_modules/.pnpm/file+ember-primitives_@glimmer+component@1.1.2_@glimmer+tracking@1.1.2_@glint+template@1.0.2__5flicjnelbvasblmzhqljcm6ai/node_modules/ember-primitives/dist/index.js'
Did you mean 'es-compat.js'?
BREAKING CHANGE: The request '<repo>/node_modules/.pnpm/@embroider+macros@1.11.0_@glint+template@1.0.2/node_modules/@embroider/macros/src/addon/es-compat' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.


Stack Trace and Error Report: /tmp/error.dump.65d732fa1322ef93e4dcf03a11d342ce.log

According to https://webpack.js.org/api/module-methods/
extensions are required.

What's the rest of the ecosystem doing? does Vite require extensions?
does the problem (requiring a .js extension) affect non-ember-addons using type=module? (TODO)
I would think that this shouldn't matter, due to the exports map not specifying extensions, and also disambiguating between import/require, etc.

Here is someone saying the bug is not in webpack: pmndrs/react-spring#2097 (comment)
but that issues was due to dist not being published 😅

@NullVoxPopuli
Copy link
Collaborator Author

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 this pull request may close these issues.

1 participant