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

Add es-compat to make asset loaders work as expected #605

Merged
merged 2 commits into from
Dec 23, 2023
Merged

Add es-compat to make asset loaders work as expected #605

merged 2 commits into from
Dec 23, 2023

Conversation

ef4
Copy link
Collaborator

@ef4 ef4 commented Dec 23, 2023

The output produced by webpack's asset/resource and asset/source loaders is just a plain CJS module with no es compatibility built in. Since ember-auto-import turns the user's import into a require() in the entryfile, webpack doesn't have any reason to know to add cjs compatibility. This results in not getting a default export on the resulting module.

This change adds general es-compatibility checking to our require() calls. This is exactly the same as embroider already does.

The output produced by webpack's `asset/resource` and `asset/source` loaders is just a plain CJS module with no es compatibility built in. Since ember-auto-import turns the user's `import` into a `require()` in the entryfile, webpack doesn't have any reason to know to add cjs compatibility. This results in not getting a `default` export on the resulting module.

This change adds general es-compatibility checking to our `require()` calls. This is exactly the same as embroider already does.
@ef4 ef4 added the bug Something isn't working label Dec 23, 2023
@ef4 ef4 merged commit 7562cfd into main Dec 23, 2023
121 checks passed
@ef4 ef4 deleted the es-compat branch December 23, 2023 03:29
@github-actions github-actions bot mentioned this pull request Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant