title: requirejs window not defined
body: <p>I'm getting this error when the optimizer is launched by grunt
  (I'm using yeoman backbone-generator )</p>
  
  <blockquote>
    <blockquote>
      <p>Running "requirejs:dist" (requirejs) task
       Error: ReferenceError: window is not defined</p>
    </blockquote>
  </blockquote>
  
  <p>I'm using requirejs and the plugin i18n.
  This is my main.js</p>
  
  <pre><code>    require.config({
      //locale: "en",
      shim: {
          underscore: {
              exports: '_'
          },
          backbone: {
              deps: [
                  'underscore',
                  'jquery'
              ],
              exports: 'Backbone'
          },
          'jquery-notify': {
              deps: [
                  'jquery'
              ]
          },
          swiper: {
              deps: [
                  'jquery'
              ],
              exports: 'Swiper'
          },
          bstrapcollapse: {
              deps: [
              'jquery',
              'bstraptransition'
              ],
              exports: 'collapse',
          }
      },
      paths: {
          jquery: '../bower_components/jquery/jquery',
          backbone: '../bower_components/backbone-amd/backbone',
          underscore: '../bower_components/underscore-amd/underscore',
  
          i18n: '../bower_components/requirejs-i18n/i18n',
  
          'backbone.marionette': '../bower_components/backbone.marionette/lib/core/amd/backbone.marionette',
          'backbone.wreqr': '../bower_components/backbone.wreqr/lib/amd/backbone.wreqr',
          'backbone.babysitter': '../bower_components/backbone.babysitter/lib/amd/backbone.babysitter',
          'jquery-ui': '../bower_components/jquery-ui/ui/jquery-ui',
          loglevel: '../bower_components/loglevel/dist/loglevel.min',
          moment: '../bower_components/moment/moment',
          alertify: '../bower_components/alertify/alertify',
          swiper: '../bower_components/swiper/dist/idangerous.swiper-2.0.min',
          fastclick: '../bower_components/fastclick/lib/fastclick',
          bstrapcollapse: '../bower_components/sass-bootstrap/js/bootstrap-collapse',
          bstraptransition: '../bower_components/sass-bootstrap/js/bootstrap-transition',
  
          'requirejs-text': '../bower_components/requirejs-text/text',
          async: '../bower_components/requirejs-plugins/src/async',
      },
      config: {
          i18n: {
              locale: JSON.parse(window.localStorage.getItem('settings')).language || 'en',
          }
      }
  });
  </code></pre>
  
  <p>I need to change language based on user input that's why i need to fetch localStorage and set the locale in the config.</p>
  
  <p>There's a solution for this?
  Thank you.</p>