cli icon indicating copy to clipboard operation
cli copied to clipboard

Feature request: requirejs Mutliversion configuration support

Open genadis opened this issue 9 years ago • 0 comments

I'm submitting a feature request

  • Library Version: 0.17.0

Please tell us about your environment:

  • Operating System: Windows 10

  • Node Version: 4.4.3

  • NPM Version: 3.10.6

  • Browser: all

  • Language: ESNext

Current behavior: Aurelia CLI uses requre loader, supporting limited loader configuration options.

Expected/desired behavior:

Allow Multiversion Support configuration. In aurelia.json allow specifying context that will be appended to the loaderConfig object that is passed to require.config(). In addition allow specifying contextGlobalObject configuration parameter in aurelia.json

  • What is the expected behavior?

In case context is specified require.config() will return require object to be used by loader. So for multiversion to to be useful, we need a way to pass the object to the loader. Since the loader-default does not support usage of custom require object. It would be great to allow the developers to still use the multiversion functionality by implementing custom loader.

One quick (and dirty) solution could be to provide additional configuration for aurelia.json, for example contextGlobalObject that will be used as name for returned require object. Aurelia cli can than perform the following when prepending the require,js script:

window[contextGlobalObject] = require.config({...});

It will allow implementing custom loader that will use it here:

window[contextGlobalObject](['require', moduleId], resolve, reject);
  • What is the motivation / use case for changing the behavior?

Support running multiple applications that use different baseUrl (Domains), module versions, etc, on single page. Each application will have it's own separate "context".

genadis avatar Aug 13 '16 14:08 genadis