Dojo build requesting already inlined Dijit templa

2019-08-06 01:22发布

问题:

I am a developer on a large Dojo project and I am having some issues with the Google Closure compiler.

We have around a hundred templates for Dijit widgets so the plan was to make the Closure compiler inline the HTML in the JavaScript file rather than require them AMD style.

To achieve this I changed the "mini" parameter in /profiles/app.profile.js from true to false.

When compiling, everything seems to work fine, even when running the app i have no issues but something strange happens.

Even if the HTML templates are correctly inlined in the dojo.js file, dojo is still making HTTP requests to the corresponding template file to the server !

By inspecting a "beautified" version of what the Closure Compiler produced I can observe that each HTML template is present in two different places :

1) Inlined in the JavaScript in the following format :

"url:path/to/my/template.html":"<p>Some more HTML</p>"

2) As a required pseudo-module in the AMD require :

   dojo/text!./path/to/my/template.html

I searched the bug reports on their website in the BuildSystem category : BuildSystem but ultimately couldn't find any relevant help.

  • Is this me just wrongly using the Google Closure Compiler or is this a open / unreported bug ?

  • How can I fix this issue ?

Thanks a lot in advance !

回答1:

If you are referring to an issue that only exists in 1.9.0, then it is https://bugs.dojotoolkit.org/ticket/17141.