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

How to declare themes, modes and workers within ember-engines #10

Open
ghost opened this issue Jul 31, 2017 · 4 comments
Open

How to declare themes, modes and workers within ember-engines #10

ghost opened this issue Jul 31, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Jul 31, 2017

I am currently moving the admin interface from the main application into an ember-engine. So far i am unable to import or declare the ember-ace settings.
Any suggestions?

@dfreeman
Copy link
Owner

I would expect the standard pattern for configuring an engine to work, something like:

module.exports = EngineAddon.extend({
  ace: {
    // ember-ace config here
  }
});

If it doesn't, that's likely a bug (either here or in ember-engines)

@ghost
Copy link
Author

ghost commented Aug 1, 2017

I tried to declare the settings exactly like this.
Sadly it dosen't work and so far I couldn't figure out why.

@dfreeman
Copy link
Owner

dfreeman commented Aug 1, 2017

Is your engine lazy or eager? It's possible you're hitting ember-engines/ember-engines#386

@tomwayson
Copy link

We are also running into an error after moving our code that uses ember-ace from a dedicated admin app to a lazy engine in our main app. Here's how the engine's index configures ember-ace:

module.exports = EngineAddon.extend({
  name: require('./package').name,

  // Configure Ace Editor
  // For engines, it seems we need to have .ace at the top level...
  // whereas for addon's it needs to be wrapped into .options: {...}
  ace: {
    modes: ['json', 'html', 'css'],
    workers: ['json', 'html', 'css'],
    exts: ['language_tools', 'searchbox'],
    // If you use this in another engine, update this location
    // [CG: 9 July 19] - I don't know when this stopped working, but using
    // worker global scope is the only way I could get this to work again
    // workerPath: '/engines-dist/layout-editor-engine/assets/ace'
  },

  isDevelopingAddon: function () {
    return true;
  },

  lazyLoading: {
    enabled: true
  }
});

When I run ember s and transition to the lazy engine's route, everything is fine, but later once the {{ember-ace}} component is rendered, I see an ace is not defined error in the console:

image

My expectation is that the ace.js file would be in-lined into the egine-vendor.js the way that it is inlined into an app's vendor.js.

I followed the above link to the ember-engines issue, and it's not obvious to me what, if any, additional actions I would need to take in order to ensure that the ace code is in-lined into my lazy engine-vendor.js. That issue (like this one) is a couple years old, and we're on the latest ember-engines (0.8.2) and and ember-ace (2.0.1), so I don't know if the proposed (and seemingly hacky) fixes are still needed.

Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants