This is my distillation of a build failure I was getting. The symptom was that when optimizing with shrinksafe my build would fail with the error:
[exec] js: "<eval'ed string>#1(Function)#1(eval)", line 127: uncaught JavaScript runtime exception: TypeError: Cannot read property "1" from null
[exec] at <eval'ed string>#1(Function)#1(eval):127
[exec] at <eval'ed string>#1(Function)#1(eval):163
If my code pulled in its nls files with a pattern such as
"dojo/i18n!./nls/MyResource"
However, this construct is common throughout much dojo code, which builds cleanly. So I experimented by copying some dojo code into my module and discovered that if the nls resource was loaded into the dojo/dojo layer then my layers built correctly, if I loaded the same nls resource in my own layer then we get the failure above.
So cutting this right down to a minimal case, I copied dijit/form/_ComboBoxMenuMixin.js to my own module and also the corresponding nls resources.
I have three test cases, one works, the other two give the failure above.
My questions:
Seems like I need to include my own nls resources in the "dojo/dojo" layer, it must be precisely this layer. Surely this can't be right? What are my alternatives?
Working profile:
layers: {
"dojo/dojo" : {
customBase: false,
include: [
"modules/nls/ComboBox",
],
exclude: []
},
"MyLayer" : {
customBase: false,
include: [
"modules/ComboCopy",
],
exclude: []
},
}
Failure: nls in same layer
layers: {
"dojo/dojo" : {
customBase: false,
include: [
],
exclude: []
},
"MyLayer" : {
customBase: false,
include: [
"modules/nls/ComboBox",
"modules/ComboCopy",
],
exclude: []
},
}
failure, load nls in a different layer name
layers: {
"myNlsLayer" : {
customBase: false,
include: [
"modules/nls/ComboBox",
],
exclude: []
},
"MyLayer" : {
customBase: false,
include: [
"modules/ComboCopy",
],
exclude: []
},