TypeError: Attempted to assign to readonly property. on Safari 6 (Mac) #392

federicogfernandez opened this Issue Jul 30, 2012 · 13 comments


None yet

5 participants


plugin.load(map.name, makeRequire(map.parentMap, true, function (deps, cb) {
deps.rjsSkipMap = true;
return context.require(deps, cb);
}), load, config);

At line deps.rjsSkipMap = true; it returns an error "TypeError: Attempted to assign to readonly property." and stops the load of the modules.


It's happening to me too. It is only happening in Safari 6. No problems in Safari 5.x or Chrome. I'm using 2.0.2


At least on my configuration, I have narrowed it down to the i18n plugin. When I remove all i18n! imports it loads fine.

shoork commented Jul 31, 2012

Hi... same problem here... also seems to be in i18n plugin....


Here's the eventual load timeout error I get (my translations are in a file called 'strings.js'): Error: Load timeout for modules: i18n!nls/strings_unnormalized2,i18n!nls/strings

jrburke commented Aug 1, 2012

Hmm, yes, something is up, it appears that when in 'use strict' mode, Safari 6 does not like it if I add a property to a string value. Other strict aware browsers allow the assignment but apparently give undefined when reading it back.

I'm investigating a fix, but in the meantime, if you are stuck, open up the require.js file and remove the 'use strict'; line near the top of the code.

@jrburke jrburke added a commit that referenced this issue Aug 1, 2012
@jrburke jrburke Fix for #392, remove strict, since problem for transpiler plugins, an…
…d r.js removes strict statements anyway by default. More consistent behavior now.
jrburke commented Aug 1, 2012

Fixed in master, just removed strict, for reasons, see commit above:


@jrburke jrburke closed this Aug 1, 2012
shoork commented Aug 1, 2012

There is always "side effect" on my code :(

shim: {
    'backbone-min': {
        deps: ['underscore-min', 'json2'],
        exports: 'Backbone'

], function(App){

And when i try to access to Backbone I get "ReferenceError: Can't find variable: Backbone" (only on safari 6)....
(and same problem with another module Globalize)

I will investigate today but others navs are ok :(

jrburke commented Aug 1, 2012

@shoork do you get that error with the latest master require.js that has a fix for the original issue in this ticket?


If you try the latest master that should perform better if it is caused by the same underlying issue.

shoork commented Aug 1, 2012

no I just make the fix "removing strict"... i'll test with lastest master this afternoon (in a few hours) to see if it solve the problem

jrburke commented Aug 1, 2012

@shoork OK. If you still see the issue, then I suggest opening a new ticket, since it will likely be a different fix, and I will want to track the fix separately from this one.


Hi James,

Same problem here. I'm using the r.js optimiser to include two locales in a build. When loading the non-root locale in the optimised scenario, the error above occurs in Safari 6 (and on iPhone). Removing the "use strict" line does indeed fix the problem.

A minimal implementation in order to reproduce this bug can be found at:


Steps to reproduce:

  • deploy the project
  • index.html is the non-optimised version, works as expected
  • index_build.html will give the "TypeError: Attempted to assign to readonly property" error.
jrburke commented Aug 4, 2012

@marcokrikke see one of my previous comments to a link to the requirejs master version that fixes the problem. That fix will be in a 2.0.5 release.


@jrburke yup, already found that one, thanks.

@jcbrand jcbrand added a commit to jcbrand/converse.js that referenced this issue Aug 4, 2014
@jcbrand jcbrand Disable 'strict' mode to avoid Safari bug. 31decd1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment