yeoman / bower-requirejs

[DEPRECATED] Automagically wire-up installed Bower components into your RequireJS config
375 stars 68 forks source link

Config variables are evaluated on write #81

Open farism opened 10 years ago

farism commented 10 years ago

My requirejs config looks as such:

requirejs.config({
    urlArgs: 'v=' + (new Date().getTime())
});

However, when I run bower-requirejs I end up with a config that has an evaluated urlArgs option. I haven't looked deep in the source (I assume stringify is being used somewhere) but I did notice that there was a comment to perhaps change writeConfig to mergeConfig. Anyone have thoughts on how this may be accomplished?

florianv commented 10 years ago

It cannot be easily changed as bower-requirejs depends on the requirejs parser, that evaluates the config when parsing it. Changing it will likely require a lot of overrides making this library harder to maintain.

A solution could be to separate the generated config from the one with variable properties to prevent them from being evaluated (see https://github.com/yeoman/bower-requirejs/issues/38).