Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Uglifyjs raise an error when js lib not having sourcemap #887

Closed
grapemix opened this issue Apr 10, 2017 · 6 comments
Closed

Uglifyjs raise an error when js lib not having sourcemap #887

grapemix opened this issue Apr 10, 2017 · 6 comments

Comments

@grapemix
Copy link

grapemix commented Apr 10, 2017

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

  1. uglifyjs raise an error when js lib not having sourcemap
  2. Chart.js and another js lib are involved. Since lots of ppl are using Chart.js, they will report this bug sooner or later, in here or somewhere else. So please don't ignore this bug.
  3. I never had problem on this problem before upgrading to 1.3.1

What behavior are you expecting?

At least compiling without error. May be skip uglifying the js lib without sourcemap.

Steps to reproduce:

  1. Installing ng-charts@1.5.0 and chart.js@2.5.0 thru npm
  2. Copying node_modules/chart.js/dist/Chart.js to www/build as doc requested
  3. Including Chart.js in the index.html as doc requested
  4. running ionic build android --prod --release

I tried Chart.js and Chart.min.js, the results are the same

insert any relevant code between the above and below backticks

Which @ionic/app-scripts version are you using?
1.3.1

1.2.5 won't raise this error, but it will fail by another error(BuildError.Error (native)) See #853
1.1.4 won't raise this error, but it will fail because of javascript HEAP MEMORY. See #808

So now we got no working version of ionic-app-scripts : (

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

[23:32:37] transpile bundle started ...
[23:33:23] transpile bundle finished in 46.08 s
[23:33:23] uglifyjs started ...
[23:33:24] ionic-app-script task: "build"
[23:33:24] Error: ENOENT: no such file or directory, open 'PROJECT_PATH/www/build/Chart.js.map' in
undefined at line undefined, col undefined, pos undefined
Error: ENOENT: no such file or directory, open 'PROJECT_PATH/www/build/Chart.js.map' in undefined at line undefined, col undefined, pos undefined
at BuildError.Error (native)
at new BuildError (PROJECT_PATH/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
at taskReject (PROJECT_PATH/node_modules/@ionic/app-scripts/dist/worker-process.js:36:22)
at PROJECT_PATH/node_modules/@ionic/app-scripts/dist/worker-process.js:14:13
at process._tickCallback (internal/process/next_tick.js:103:7)

@drewhawken
Copy link

drewhawken commented Apr 10, 2017

I get the same error with any plain js files I include in the build. @danbucholtz this is the issue I mentioned you in on Friday.

@danbucholtz
Copy link
Contributor

Working on this now.

Thanks,
Dan

@drewhawken
Copy link

I did a grotesque hack of uglifyjs.js to work around the issue for myself, will appreciate a legit fix ;)

if (path_1.extname(file) === '.js'
        && file.indexOf('polyfills') === -1
        && file.indexOf('sw-toolbox') === -1
        && file.indexOf('.map') === -1
        && file.indexOf('appSettings') === -1
        && file.indexOf('local.env.client') === -1
        && file.indexOf('atatus.min') === -1
        && file.indexOf('aws-sdk.min') === -1
        && file.indexOf('web-animations-next.min') === -1
        && file.indexOf('pubnub.min') === -1) {

@danbucholtz
Copy link
Contributor

This is fixed in 1.3.2.

Thanks,
Dan

@grapemix
Copy link
Author

grapemix commented Apr 14, 2017

I just want to confirm 1.3.2 fixed this bug. And thanks, ionic team.

@whitecat
Copy link

What was done to fix the problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants