Angular2-signaturepad: Unable to paint in prod mode on device

In browser mode or in normal build the drawing works properly.
But when you build in --prod or --prod --release does not succeed in drawing and gives the following error
vendor.js:1 ERROR ReferenceError: a198254 is not defined
at a._calculateCurveControlPoints (10.js:1)
at a._addPoint (10.js:1)
at a._strokeUpdate (10.js:1)
at a._strokeMoveUpdate (10.js:1)
at HTMLCanvasElement._handleTouchMove (10.js:1)
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (vendor.js:1)
at t.invokeTask (polyfills.js:3)
at r.runTask (polyfills.js:3)
at e.invokeTask [as invoke] (polyfills.js:3)

Thank you very much to anyone who helps

What is your ionic info output?

@ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.0.2
Node              : v6.10.3
npm               : 3.10.10
OS                : Windows 10

What command are you using to build?
It works in ionic serve?

yes it work in ionic serve and device to. with “ionic cordova build android” or "ionic cordova build android --release"
the problem is in the --prod
i try to build in --release without --prod and its work fine in device
but the build without prod is big and slow
tenks for your help

this the line from the build code 10.js
"m=n.x-(a198257.x+(r-d)*v),g=n.y-(a198257.y+(u-c)*v);"
and i search in all build pages and not define var like this : a198257

Ok, a198257 means something to me - I have seen a similar number being randomly inserted before, breaking code. I’ll see if I can find it and find out if there was a solution.

thank you very much :ok_hand:

Help is still in a meeting, but coming :wink:

Thanks this will really help me. I’m stuck

Hey guys,

So @meni_oz, I had this exact issue on Monday night! I found when I was building with package-lock.json, I could proceed, without it, I could not which implied that there was a dependency update issue somewhere.

Long after trawling and figuring out what was different, uglify-js was the most likely candidate; @ionic/app-scripts relies on uglify-es which is a distribution of uglify-js. @ionic/app-scripts has a loose dependency of 3.x. A few days ago, uglify-js@3.2.0 was released after an upgrade from uglify-js@3.1.0 so I figured this was the problem!

I manually installed uglify-js@3.1.0 (see below for instructions), and the problem went away.`

tl;dr
A dependency, uglify-js@3.2.0, causes a problem, install uglify-js@3.1.0 by running the following command in your Ionic project.

npm i uglify-js@3.1.0

That worked for me :slight_smile: I dunno who the bug lies with, so I might raise it to uglify-js, ionic-app-scripts and the signature-pad…

2 Likes

Ok really thanks, I’ll try now and update. I wish that would solve the problem

1 Like

Cool! Did it work?

I think the bug needs to be raised to uglify-js, I will do so in the morning.

no its not work for me
i installed older version of app-scripts ( @ionic/app-scripts@1.3.0) and angular 4 and everything back to works perfect
I sat for hours trying to solve it until I gave up
Thanks anyway