{"action":"created","issue":{"url":"https://api.github.com/repos/NativeScript/nativescript-angular/issues/1011","repository_url":"https://api.github.com/repos/NativeScript/nativescript-angular","labels_url":"https://api.github.com/repos/NativeScript/nativescript-angular/issues/1011/labels{/name}","comments_url":"https://api.github.com/repos/NativeScript/nativescript-angular/issues/1011/comments","events_url":"https://api.github.com/repos/NativeScript/nativescript-angular/issues/1011/events","html_url":"https://github.com/NativeScript/nativescript-angular/issues/1011","id":260956183,"number":1011,"title":"Error in Webpack + Uglification","user":{"login":"cmargulhano","id":11628058,"avatar_url":"https://avatars1.githubusercontent.com/u/11628058?v=4","gravatar_id":"","url":"https://api.github.com/users/cmargulhano","html_url":"https://github.com/cmargulhano","followers_url":"https://api.github.com/users/cmargulhano/followers","following_url":"https://api.github.com/users/cmargulhano/following{/other_user}","gists_url":"https://api.github.com/users/cmargulhano/gists{/gist_id}","starred_url":"https://api.github.com/users/cmargulhano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmargulhano/subscriptions","organizations_url":"https://api.github.com/users/cmargulhano/orgs","repos_url":"https://api.github.com/users/cmargulhano/repos","events_url":"https://api.github.com/users/cmargulhano/events{/privacy}","received_events_url":"https://api.github.com/users/cmargulhano/received_events","type":"User","site_admin":false},"labels":[{"id":213904415,"url":"https://api.github.com/repos/NativeScript/nativescript-angular/labels/question","name":"question","color":"00AF64","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-09-27T12:31:33Z","updated_at":"2017-10-02T13:46:30Z","closed_at":null,"author_association":"NONE","body":"After run this: tns build android --clean && npm run start-android-bundle --uglify --snapshot\r\n\r\nI got this error after running uglification:\r\n\r\nERROR in bundle.js from UglifyJs\r\nUnexpected token: name (window) [bundle.js:29157,4]\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/NativeScript/nativescript-angular/issues/comments/333539020","html_url":"https://github.com/NativeScript/nativescript-angular/issues/1011#issuecomment-333539020","issue_url":"https://api.github.com/repos/NativeScript/nativescript-angular/issues/1011","id":333539020,"user":{"login":"sis0k0","id":7893485,"avatar_url":"https://avatars2.githubusercontent.com/u/7893485?v=4","gravatar_id":"","url":"https://api.github.com/users/sis0k0","html_url":"https://github.com/sis0k0","followers_url":"https://api.github.com/users/sis0k0/followers","following_url":"https://api.github.com/users/sis0k0/following{/other_user}","gists_url":"https://api.github.com/users/sis0k0/gists{/gist_id}","starred_url":"https://api.github.com/users/sis0k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sis0k0/subscriptions","organizations_url":"https://api.github.com/users/sis0k0/orgs","repos_url":"https://api.github.com/users/sis0k0/repos","events_url":"https://api.github.com/users/sis0k0/events{/privacy}","received_events_url":"https://api.github.com/users/sis0k0/received_events","type":"User","site_admin":false},"created_at":"2017-10-02T13:46:30Z","updated_at":"2017-10-02T13:46:30Z","author_association":"COLLABORATOR","body":"@cmargulhano @ferpaganucci ,\r\nUglifyJS 2 doesn't support ES6 code. In @ferpaganucci's case, the `nativescript-toast` plugin is not transpiled to es5 and uglify is failing to parse it. \r\n@cmargulhano, you must have plugin or plugins that are distributed in es6, too.\r\nYou can either find the es6 plugins and transpile them to es5 or use UglifyJS 3, which supports es6+. Here's how:\r\n\r\n1. Install the latest beta version of the corresponding webpack plugin:\r\n `npm i -D uglifyjs-webpack-plugin@1.0.0-beta.2`\r\n\r\n2. Modify your webpack configuration to use the above plugin instead of the one, distributed with webpack:\r\n\r\n``` js\r\n// webpack.config.js\r\nconst UglifyJsPlugin = require(\"uglifyjs-webpack-plugin\");\r\n// ...\r\n\r\nfunction getPlugins() {\r\n// line 209\r\n    if (env.uglify) {\r\n        plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true }));\r\n        plugins.push(new UglifyJsPlugin({\r\n            uglifyOptions: {\r\n                mangle: { reserved: [ nsWebpack.uglifyMangleExcludes ]},\r\n                compress: true\r\n            }\r\n        }));\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"sis0k0"}}