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:


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  
    12061206    }
    12071207    /*global define:false */
    12081208    if (typeof define === "function" && define.amd) {
    1209         define("moment", [], function () {
     1209        define("moment/moment", "moment", [], function () {
    12101210            return moment;
    12111211        });
    12121212    }

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 djmitche

Changing the source line to

define([], function() {

fixes this, so it looks like dojo is just blindly prepending the mid to the define invocation.

comment:2 Changed 10 years ago by bill

Component: GeneralBuildSystem
Owner: set to Rawld Gill

comment:3 Changed 9 years ago by Rawld Gill

Milestone: tbd1.9

comment:4 Changed 9 years ago by Rawld Gill

Status: newassigned

comment:5 Changed 9 years ago by Rawld Gill

Resolution: worksforme
Status: assignedclosed

Search for insertAbsMids in 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.

Note: See TracTickets for help on using tickets.