embroider-build / ember-auto-import

Zero config import from npm packages
Other
361 stars 110 forks source link

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

Closed ef4 closed 6 months ago

ef4 commented 6 months ago

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.