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

Support for scoped/organizational engines => mount('@org/engine') #524

Closed
gossi opened this issue Mar 6, 2018 · 15 comments

Comments

Projects
None yet
7 participants
@gossi
Copy link

commented Mar 6, 2018

So, I tried to create a scoped engine @org/engine and tried mounting it in the dummy app:

Router.map(function () {
  this.mount('@org/engine, { path: '/foo'});
});

which gives this error: Assertion Failed: Asset manifest does not list any available bundles.

I traced it down to this line: https://github.com/ember-engines/ember-asset-loader/blob/f8f1a448456697dbf128da27a15ca034d848763a/addon/services/asset-loader.js#L230

Second, here is the function that invokes the one above:

enginePromise = this._assetLoader.loadBundle(name).then(

@gossi

This comment has been minimized.

Copy link
Author

commented Mar 6, 2018

Oh @lennyburdette hit me up on slack, he already did a PR to support this. See ember-engines/ember-asset-loader#63

@dfreeman

This comment has been minimized.

Copy link
Contributor

commented Mar 23, 2018

Other than publishing a release of ember-asset-loader that has that fix in it, is there anything else blocking the use of engines with scoped names?

@lennyburdette

This comment has been minimized.

Copy link
Contributor

commented Mar 23, 2018

@dfreeman not that I'm aware. It worked when I was testing them locally.

@lennyburdette

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2018

So it turns out that fixing ember-asset-loader was only step 1. I didn't test out subroutes.

I believe the problem is that the engine is trying to look up its route map through the resolver with the key route-map:@scope/pkg-name. The @ sigil already has some meaning in the classic resolver so it's being stripped away (see relevant tests here). It ends up calling require('scope/pkg-name/routes') instead.

@rwjblue Do you think it's worth it to extend the classic resolver to handle route-map:@scope/pkg-name correctly? Or will it add more confusion because of the other uses of @?

@gossi

This comment has been minimized.

Copy link
Author

commented Apr 29, 2018

Any progress here?

@rwjblue

This comment has been minimized.

Copy link
Member

commented Oct 2, 2018

@rwjblue Do you think it's worth it to extend the classic resolver to handle route-map:@scope/pkg-name correctly? Or will it add more confusion because of the other uses of @?

@lennyburdette - We can probably teach the resolver specifically about :@, which should unblock us here...

@buschtoens

This comment has been minimized.

Copy link
Contributor

commented Nov 13, 2018

https://github.com/ember-cli/ember-resolver/blob/master/addon/resolvers/classic/index.js#L46-L75

Seems like there's already an exception for helper:@content-helper. Would the valid fix be just allowing any fullName containing ${type}:@${name}?

I've submitted a PR here: ember-cli/ember-resolver#270

@jherdman

This comment has been minimized.

Copy link
Contributor

commented Mar 21, 2019

Is this resolved now? ember-cli/ember-resolver#330 suggests as much.

@villander

This comment has been minimized.

Copy link
Member

commented Mar 27, 2019

@buschtoens it's ember-cli/ember-resolver#330 resolved your problem with scope? ca we close this issue?

@buschtoens

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2019

Yes, it did. :)

@villander

This comment has been minimized.

Copy link
Member

commented Mar 27, 2019

@rwjblue it's already fixed, can we close this : )

@buschtoens can you to document this, on http://ember-engines.com/ please?

@buschtoens

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2019

It pretty much just works like with non-scoped engines.

// router.js
this.mount('@my-org/my-engine', {
  path: 'foo',
  as: 'foo'
});
// app.js
const App = Application.extend({
  // ...
  engines: {
    '@myOrg/myEngine': {
      dependencies: {
        services: [ /* ... */ ],
        externalRoutes: { /* ... */ }
      }
    }
  }
});
@villander

This comment has been minimized.

Copy link
Member

commented May 16, 2019

@gossi this issue was solved for you as well?

@gossi

This comment has been minimized.

Copy link
Author

commented May 17, 2019

Pretty sure it does 👍

@villander

This comment has been minimized.

Copy link
Member

commented May 17, 2019

@gossi can you close this issue, please? I don't privilege to do it

@gossi gossi closed this May 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.