Opened 7 years ago

Last modified 6 years ago

#15350 assigned enhancement

Dojo build and simplified CommonJS wrapping

Reported by: Paul Christopher Owned by: Rawld Gill
Priority: low Milestone: 2.0
Component: BuildSystem Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

Refering to the discussion on the interest mailing list http://dojo-toolkit.33424.n3.nabble.com/Dojo-build-and-simplified-CommonJS-wrapping-td3972049.html:

Using "simplified CommonJS wrapping" for loading modules seems to not work properly when doing a build.

Could this be supported in future? In my eyes, this way of requiring modules is much more readable and elegant.

Change History (3)

comment:1 Changed 6 years ago by Rawld Gill

Milestone: tbd2.0
Priority: undecidedlow
Status: newassigned

This is not an easy problem. In order to do this correctly, the builder needs to parse the code. Even then, there is the potential for computing the dependency vectors improperly. For example, what about conditionally-included modules?

This won't make it into the 1.x line. We'll look again for 2.0

comment:2 Changed 6 years ago by Paul Christopher

I'm not seeking for the perfect solution (I personally have never used conditionally-included modules). A simple basic support using "simplified CommonJS wrapping" for "normal" requires would be enough and great. This would improve code readability quite a lot. Most people I know are quite unhappy with the new AMD syntax and its need to keep two separate lists "in sync".

Thus an early, basic support of the "simplified CommonJS wrapping" approach would be great. And people who want to include modules conditionally should do it the "old way" and not by "simplified CommonJS wrapping".

comment:3 Changed 6 years ago by chris2m

I'd like to support Paul in his argument. An early basic support for "simplified CommonJS wrapping" would be great as it would also bring us closer to using Closure Compiler in ADVANCED_MODE - a feature often requested and discussed in the dojo forums and on stackoverflow (see [1] - [4]).

In [2] Ben states "ultimately, the plan is to add a parser to the build system (scheduled for 1.8) and produce an ast to help with the minification process." I believe, there is no such parser yet in the build system. Have you checked out uglify-js? It contains a great javascript based javascript parser that can deal with all kinds of real world javascript.

[1] http://dojo-toolkit.33424.n3.nabble.com/Using-Dojo-with-Closure-Compiler-and-Advanced-Optimizations-td2448749.html

[2] http://dojo-toolkit.33424.n3.nabble.com/Dojo-Build-system-improvements-possible-td3593048.html#a3599554

[3] http://dojo-toolkit.33424.n3.nabble.com/Closure-Compiler-obfuscation-with-text-plugin-for-templates-in-1-7-with-AMD-td3158785.html#a3159400

[4] http://stackoverflow.com/questions/1912655/dojo-and-google-closure-compiler

...

Note: See TracTickets for help on using tickets.