bower-requirejs icon indicating copy to clipboard operation
bower-requirejs copied to clipboard

Config variables are evaluated on write

Open farism opened this issue 10 years ago • 1 comments

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?

farism avatar Apr 28 '14 23:04 farism

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).

florianv avatar Aug 18 '14 21:08 florianv