Opened 10 years ago
Closed 9 years ago
#16387 closed defect (worksforme)
Build process rewrites define(..) to an invalid form
Reported by: | djmitche | Owned by: | Rawld Gill |
---|---|---|---|
Priority: | undecided | Milestone: | 1.9 |
Component: | BuildSystem | Version: | 1.8.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I'm working on including moment.js in my app as a Dojo package. This works fine from source, but when I build the app, something in the build process rewrites moment.js as follows:
-
moment/moment.js
old new 1206 1206 } 1207 1207 /*global define:false */ 1208 1208 if (typeof define === "function" && define.amd) { 1209 define("moment ", [], function () {1209 define("moment/moment", "moment", [], function () { 1210 1210 return moment; 1211 1211 }); 1212 1212 }
Which is too many arguments for define
. This seems to happen with optimization enabled, but the above example is with optimize: ''
.
Change History (5)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Component: | General → BuildSystem |
---|---|
Owner: | set to Rawld Gill |
comment:3 Changed 9 years ago by
Milestone: | tbd → 1.9 |
---|
comment:4 Changed 9 years ago by
Status: | new → assigned |
---|
comment:5 Changed 9 years ago by
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
Search for insertAbsMids in http://dojotoolkit.org/reference-guide/1.8/build/qref.html#build-qref and you'll see that there is a switch that controls if absolute module ids are automatically inserted (also documented in the above reference).
You can check the value of this build knob by running a build with the "--check" command line argument. If it is not what you want, you can set it either in a profile or directly on the command line (--insertAbsMids 0).
Using absolute module ids is highly discouraged. However, for some backcompat programs, it is necessary.
Changing the source line to
fixes this, so it looks like dojo is just blindly prepending the mid to the define invocation.