Skip to content

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

Description

@tomwayson

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?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions