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

Allow consuming ember apps to specify the name of the client-side global require() function #175

Open
tomwayson opened this issue Nov 16, 2017 · 2 comments

Comments

@tomwayson
Copy link

In order to avoid conflicts w/ Dojo's require() my addon (and others) have to change the name of the global require() function used by Ember.

When running an example app that uses my addon in FastBoot, I see this error when I load the page: TypeError: ctx.require is not a function, which comes from this line:

return ctx.require('~fastboot/app-factory');

I've been able to get around that and get the app working by passing in requireFunctionName as one of the sandboxGlobals and changing the above line to:

      const requireFunctionName = ctx.requireFunctionName || 'require';
      return ctx[requireFunctionName]('~fastboot/app-factory');

There's probably a better way, but that does work, and doesn't break any of FastBoot's existing tests.

Would you accept a PR that adds and documents that change? If not, would you recommend a different way that I can achieve the same?

@tomwayson
Copy link
Author

tomwayson commented Jan 17, 2018

Before I invest more time in ember-fastboot/ember-cli-fastboot#553 I wanted to see if there's any update on this issue.

For context, we can load our library in SSR apps using other frameworks, just not Ember. We have a few internal teams and customers using Ember, and at least for our own team's Ember based application, SEO is a high priority.

So, would you accept a PR w/ my proposed changes above so that we can get SSR working for our application and unlock it for other applications using our library w/ Ember?

@dmfenton
Copy link

This is a high priority for me too. Would love to hear some feedback on this request.

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

3 participants