embroider-build / ember-auto-import

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

Error loading fingerprinted lazy engine assets after moving to ember-auto-import v2 #609

Open tomwayson opened 4 months ago

tomwayson commented 4 months ago

After moving from ember-auto-import 1.x to v2.7.2 our app is now failing w/ ember-asset-loader errors like The bundle "layout-editor-engine" failed to load. Upon investigation, I found that the app is making failed requests for lazy-loaded engine assets b/c it's not using fingerprinted URLs even though the assets are fingerprinted:

image

The build is fingerprinting the asset file names correctly, and they are getting correctly deployed (i.e. if I manually make a request to the asset using the fingerprinted filename it succeeds).

I'm not sure where the URLs for engine assets end up in the build, but it looks like after upgrading ember-auto-import to v2 they're no longer getting updated with the fingerprinted file names. When I revert back to ember-auto-import 1.12.1 and re-build the app it now uses fingerprinted URLs when requesting the engine assets.

Were' currently on:

ember-cli: 3.19.0 node: 14.17.0 ember-source: 3.16.6 ember-auto-import: 2.7.2 ember-engines: 0.8.5 ember-asset-loader: 0.6.1

After scouring issues in all the above addons, I couldn't really find any issues that correspond to this. I did notice that ember-asset-loader v1.0.0 introduces some enhancements related to ember-auto-import in lazy engines, but it seems related to future functionality. I would try and bring that into our app, via ember-engines 0.9.0, but that has breaking changes that say it's not compatible w/ Ember 3.16.

tomwayson commented 4 months ago

It seems like after updating ember-auto-import to 2.x (along w/ the other required dependencies in order to get that working), something is causing broccoli-asset-rev to run after ember-engines. See https://github.com/ember-engines/ember-engines/pull/632#issuecomment-1930623370 for more details. I am able to temporarily fix the issue by adding "after": "broccoli-asset-rev" to "ember-addon" in ember-engine's package.json.

Any idea why upgrading ember-auto-import would have caused that?