Opened 7 years ago

Closed 4 years ago

Last modified 4 years ago

#16655 closed defect (fixed)

[patch] access to undefined property in writeOptimized.js

Reported by: Michael Frischeisen-Koehler Owned by: dylan
Priority: undecided Milestone: 1.9.8
Component: BuildSystem Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:

Description

When trying to build a custom layer, the following error occurs:

[exec] js: "<eval'ed string>#1(Function)#1(eval)", line 308: uncaught JavaScript runtime exception: TypeError: Cannot read property "copyright" from undefined 

This seems to occur when the "synthetic" nls files are processed in writeOptimized.js. It happens when the first i18n resource for the custom layer is processed (customLayer_ar.js). The pack property of the processed resource is undefined, hence the error occurs when trying to pass resource.pack.copyright to the compile function:

return compile(resource, resource.getText(), resource.pack.copyright, bc.optimize, callback);

Replacing this with

var copyright = resource.pack ? resource.pack.copyright : bc.copyright;
return compile(resource, resource.getText(), copyright, bc.optimize, callback);

solved the problem for me, however I'm not sure whether something else is broken that leads to the pack property not being defined.

This problem has been discussed in the dojo interest mailing list, however it wasn't solved.

Attachments (1)

copyright.patch (993 bytes) - added by Martin Minka 7 years ago.
[Patch][CLA]this patch for me on current master

Download all attachments as: .zip

Change History (18)

comment:1 Changed 7 years ago by Martin Minka

I have the same issue and the proposed patch by micschro fixed the issue.

Without this fix I am not able to build my project.

comment:2 Changed 7 years ago by Rawld Gill

Milestone: tbd1.9
Status: newassigned

comment:3 Changed 7 years ago by Martin Minka

please could this be solved in trunk ? writeOptimized.js was reworked, but this issue is still not fixed

thank you very much

Changed 7 years ago by Martin Minka

Attachment: copyright.patch added

[Patch][CLA]this patch for me on current master

comment:4 Changed 7 years ago by Rawld Gill

Resolution: worksforme
Status: assignedclosed

I can't duplicate the NLS problem. If it is really related to #16106, then maybe it's solved. Otherwise, please reduce to a small test case and post.

Thanks!

comment:5 Changed 7 years ago by Martin Minka

I have modified dojo-boilerplate project https://github.com/k2s/dojo-boilerplate/commit/244eeccad2825b8b03a5a701781d18f575030cfa

this should end with error:

git clone git://github.com/k2s/dojo-boilerplate.git
cd dojo-boilerplate
git submodule update --init --recursive
./build.sh

comment:6 Changed 7 years ago by Martin Minka

this ticket should not be closed

could this pls. be fixed until 1.9 release ? I think, my example is easy to use and to see that this problem really exists and to test if provided patch is ok to be included to 1.9.

I will do my best to support you if there are still open questions.

thank you very much

comment:7 Changed 7 years ago by javierg

I am seeing the same problem, however only if the output layer location is different than the source folder.

So for example, the error will occur if you try to create a layer like this:

layers: {
  "output/engine":{
     include: [
	"engine/myWidget"
     ]
}

But you will see no error if you rename your layer like this:

layers: {
  "engine/engine":{
     include: [
	"engine/myWidget"
     ]
}

Hope this helps...

comment:8 Changed 6 years ago by hackiechain

I met the same situation when I try to build my project with dojo.

starting writing resources...
[TypeError: Cannot read property 'copyright' of undefined]
TypeError: Cannot read property 'copyright' of undefined
    at Array.0 (/workspace/project/web/trunk/lib/util/build/transforms/writeOptimized.js:26:85)
    at advance (/workspace/project/web/trunk/lib/util/build/main.js:126:25)
    at returnFromAsyncProc (/workspace/project/web/trunk/lib/util/build/main.js:105:5)
    at /workspace/project/web/trunk/lib/util/build/transforms/writeAmd.js:353:5
    at /workspace/project/web/trunk/lib/util/build/node/fs.js:23:9
    at Object.oncomplete (fs.js:107:15)

I'v just download the dojo 1.9.1 SDK. This patch works for me.

layers looks like this.

		layers : {
			'web/startup' : {
				include : [ 'dojo/dojo' ],
				boot : true,
				customBase : true
			}
		}

comment:9 Changed 6 years ago by salinaale

I've the same issue also with dojo 1.9.3 SDK.... Only If i patch the writeOptimized.js file i'm able to execute the custom build....

comment:10 Changed 5 years ago by bjoern.burger

We have the same issue with dojo 1.9.2 SDK (also traceable with 1.10.0). The proposed patch fixed the issue. We would really appreciate if you can solve this in the next dojo 1.9/1.10 release. Thanks!

comment:11 Changed 5 years ago by bill

Milestone: 1.9tbd
Resolution: worksforme
Status: closedreopened
Summary: build: access to undefined property in writeOptimized.js[patch] access to undefined property in writeOptimized.js

Reopening as test case provided (https://github.com/k2s/dojo-boilerplate/commit/244eeccad2825b8b03a5a701781d18f575030cfa), and trivial patch also provided.

comment:12 Changed 4 years ago by dylan

Milestone: tbd1.11
Owner: changed from Rawld Gill to dylan
Status: reopenedassigned

comment:13 Changed 4 years ago by dylans <dylan@…>

Resolution: fixed
Status: assignedclosed

In 5e47e1457a1f7c259b7bfab0588e3d0b0c723a33/util:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:14 Changed 4 years ago by dylans <dylan@…>

In 029e11d06e2c36aa1453bb26a43b5cfaa374ccdc/util:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:15 Changed 4 years ago by dylans <dylan@…>

In 17dc90faef48901adbbb27709061bd9607c13f9a/util:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:16 Changed 4 years ago by dylan

Sorry this took so long to land. It's in master and backported to 1.10.x and 1.9.x

comment:17 Changed 4 years ago by dylan

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