Opened 2 years ago

Last modified 20 months ago

#18957 new defect

Closure Compiler regression, files with #

Reported by: dylan Owned by: dylan
Priority: high Milestone: 1.14
Component: BuildSystem Version: 1.12.1
Keywords: Cc:
Blocked By: Blocking:


From Nick Fenwick on the mailing list:

We've been using 1.10.x for a long time and have a working build system. I just checked out 1.12.1 of dojo, dojox, dijit, util and ran a build. It's failing with errors that the 1.10.x build did not, I presume this is because the Closure Compiler was updated in either 1.11 or 1.12. Our build profile specifies to use the Closure Compiler:

var profile = {

action: "release", optimize: "closure", layerOptimize: "closure", cssOptimize: "comments",

The build ends with:


starting cleaning up... waiting for the optimizer runner to finish... error(352) Optimizer reported errors; consult build report for details. starting reporting... Report written to /run/shm/winmob_build/build-report.txt Process finished normally.

errors: 26 warnings: 1029 build time: 60.155 seconds


I get many instances of this kind of output in build-output.txt:


/run/shm/build/node_modules/phonegap-build-api/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js: run.js.uncompressed.js:2: ERROR - Parse error. '}' expected #!/usr/bin/env node

1 error(s), 0 warning(s) =====

Basically every .js file with a shebang line errors. Obviously the shebang line is not valid Javascript and so the file fails a basic compile. I've Googled a few different ways and am not finding any reference to this error.

The 1.12 release notes say "Updated Closure Compiler to v20160911 to support ES6 grammar" and the Closure Compiler project has a commit was back before v20140625 that looks like it adds shebang support -

Is this common, and how do you run a Dojo build to get around this? Pass a parameter to Closure Compiler via optimizeOptions to instruct it to ignore shebang lines? Somehow exclude the offending files from the compiler's workload?

Change History (3)

comment:1 Changed 2 years ago by dylan


Further note from Nick:

Thanks Dylan! I had a moment of clarity, as one often does just after posting on the Internet, and realised that all of the problematic files are actually not part of the web app. They are all either pre-build prep scripts that we have written, or node_modules content from third party libraries used by analytical and test scripts. All these scripts are hanging around in our web app src tree, because we never had a good reason to put them anywhere else.

I wiped out all the node_modules folders, and removed the shebangs from the few executable .js files of ours, and the build then completes just fine.

I'll rearrange our src tree so non-web content is not in the modules the Dojo build pulls in, and the problem will have gone away. It would still be nice to know how to control this but in our project we do not actually need these shebang'd scripts in our minified Dojo build. Perhaps some server side projects would, so the ticket may be of use.

comment:2 Changed 2 years ago by jgoknowis

How does u do that? can u post your profile.js please

comment:3 Changed 20 months ago by dylan

Milestone: 1.131.14
Note: See TracTickets for help on using tickets.