ember-asset-loader
ember-asset-loader copied to clipboard
No manifest generated for engine when external addon extends from ember-asset-loader
I have an app already built that demonstrates this error. Please see this repo. In a nutshell, a fatal error is thrown when visiting an engine's route if that engine lists an external addon, which lists ember-asset-loader as a dependency, as a dependency.
Structure
Host app:
- Depends on ember-engines
- Depends on external addon ("some-addon")
- Contains an engine that depends on "some-addon"
External addon ("some-addon"):
- Depends on ember-asset-loader
- index.js extends from manifest-generator.js
Error thrown: The below error is thrown when visiting the engine's route
rsvp.js:26 Uncaught Error: Failed to load asset manifest. For browser environments, verify the meta tag with name "basic-engine/config/asset-manifest" is present. For non-browser environments, verify that you included the node-asset-manifest module. at Module.callback (asset-manifest.js:23) at Module.exports (loader.js:106) at Module._reify (loader.js:143) at Module.reify (loader.js:130) at Module.exports (loader.js:104) at requireModule (loader.js:27) at r (loader.js:176) at resolveInitializer (index.js:10) at registerInstanceInitializers (index.js:33) at loadInitializers (index.js:69)
Adding a dependency on ember-asset-loader
does not inherently cause an asset manifest to be created. You need to either include ember-engines
(which does create an assert manifest), or configure something in your application to use ManifestGenerator.extend
itself.
I can't actually tell what you are trying to do here. Are you trying to emit two asset manifests?
There definitely is a bug here: lib/manifest-generator.js
uses the second argument to contentFor
to determine the modulePrefix
which will not match the expected module prefix when app/config/asset-manifest.js
module is evaluated.
https://github.com/ember-engines/ember-asset-loader/blob/661c287181311bb107b16a78bf570f3ca0ebbb38/lib/manifest-generator.js#L21
Should be gathering the modulePrefix from the findHost
result, not the second argument. That would resolve this specific error.
Rob and I spoke offline. I have an external addon which lazily-loads a static asset on behalf of consuming host apps. We were using ember-asset-loader's loadAsset method to achieve this. The issue brought up in this ticket exists if the host app also depends on ember-engines, which itself depends on, and extends from, ember-asset-loader and therefore produces its own manifest.
In short, a host app with an engine which also brings in an external addon with ember-asset-loader will result in a fatal error.
We have decided that, for the time being, we will do our own simple script loading in our addon and remove ember-asset-loader as a dependency. Potentially in the near future we can modify ember-asset-loader to allow for loading of an asset without a manifest.