Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#14947 closed defect (worksforme)

dojo/i18n is loaded separately even if it's included in a layer

Reported by: liucougar Owned by: Rawld Gill
Priority: low Milestone: 1.8
Component: BuildSystem Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by liucougar)

extract all the files in the attached archive into dojo/

run build script under util/buildscript:

./build.sh releaseDir=../ releaseName=buildingrelease action=release profile=../../dojo/my.profile.js

load /buildingrelease/dojo/my.html in browser, notice that i18n is requested separately after my.js layer is loaded, although i18n.js is already inlined in the my.js layer

if I manually add "*noref":1 to the require({cache:{...}} in the built my.js layer file, then i18n won't be separately loaded again

it seems to me that if a layer has all the dependency modules included, builder should ensure the built layer does not need to 're-load' modules which are already baked into the layer

this is related to #13612

Attachments (1)

my.tar.bz2 (511 bytes) - added by liucougar 8 years ago.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by liucougar

Attachment: my.tar.bz2 added

comment:1 Changed 8 years ago by liucougar

Description: modified (diff)
Summary: module is loaded separately even if it's included in a layerdojo/i18n is loaded separately even if it's included in a layer

comment:2 Changed 7 years ago by Rawld Gill

Milestone: tbd1.8
Priority: undecidedlow
Resolution: worksforme
Status: newclosed

Hi Cougar! Thanks for the report. This is a little tricky...

Normally the loader will consume all modules built into a layer; however, the dojo/i18n layer is the one exception. Since preloadLocalizations is necessarily called before the layer module is defined (e.g., dojo/my in your example), dojo/i18n is needed before the loader can consume the cache. Recall the cache is consumed when a module is defined, which allows for module remapping.

The best solution is to build dojo/i18n into dojo.js. Here is the layer config that does that

	layers: {
		"dojo/dojo":{
			include:[
				"dojo/i18n"
			]
		},
		"dojo/my": {
			include: [
				"dojo/my"
			]
		}
	}

I tested this and it seems to work correctly.

comment:3 Changed 7 years ago by Patrick Ruzand

Hi rawld,

does this workaround still applies to 1.8 ? (I have the same error with 1.8 custom build and just want to be sure it is indeed expected). Thx

Note: See TracTickets for help on using tickets.