私は grunt を介して requirejs オプティマイザー (r.js) を使用しています。これが私の requirejs 構成です。
requirejs.config
baseUrl: '/scripts'
locale: window.localStorage.getItem('locale') || null
...
問題は、grunt r.js プラグイン ( https://github.com/gruntjs/grunt-contrib-requirejs ) が、requirejs 構成内で変数を使用しようとするたびにエラーをスローすることです。
The main config file cannot be used because it cannot be evaluated correctly while running in the optimizer. Try only using a config that is also valid JSON, or do not use mainConfigFile and instead copy the config values needed into a build file or command line arguments given to the optimizer.
変数をロケールとして使用し、r.js を同時に使用できましたか?