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

No manifest generated for engine when external addon extends from ember-asset-loader #87

Open
evanfarina opened this issue Dec 4, 2019 · 4 comments

Comments

@evanfarina
Copy link
Contributor

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)

@rwjblue
Copy link
Member

rwjblue commented Dec 4, 2019

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.

@rwjblue
Copy link
Member

rwjblue commented Dec 4, 2019

I can't actually tell what you are trying to do here. Are you trying to emit two asset manifests?

@rwjblue
Copy link
Member

rwjblue commented Dec 4, 2019

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.

var metaName = config.modulePrefix + '/config/asset-manifest';

Should be gathering the modulePrefix from the findHost result, not the second argument. That would resolve this specific error.

@evanfarina
Copy link
Contributor Author

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.

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

No branches or pull requests

2 participants