Closed ahmedalmulki closed 6 years ago
Hey! Have you read the error message? It seems that your code is not valid JavaScript.
I tried many javaScript files it's worked when I change the minifier to google clouser compiler , but on YUI compressor not worked , I have to work with YUI Composer because my team use this minifier .
Perhaps there is a bug in YUI compressor? I don't know. My package is only a wrapper for multiple compressors. I personally use UglifyJS, because then I don't need Java.
Is it important that your team uses YUI compressor?
But are you sure your code is valid? Can you post your JS file here?
`(() => { 'use strict' const WebPush = { init () { self.addEventListener('push', this.notificationPush.bind(this)) self.addEventListener('notificationclick', this.notificationClick.bind(this)) self.addEventListener('notificationclose', this.notificationClose.bind(this)) },
/**
* Handle notification push event.
*
* https://developer.mozilla.org/en-US/docs/Web/Events/push
*
* @param {NotificationEvent} event
*/
notificationPush (event) {
if (!(self.Notification && self.Notification.permission === 'granted')) {
return
}
// https://developer.mozilla.org/en-US/docs/Web/API/PushMessageData
if (event.data) {
event.waitUntil(
this.sendNotification(event.data.json())
)
}
},
/**
* Handle notification click event.
*
* https://developer.mozilla.org/en-US/docs/Web/Events/notificationclick
*
* @param {NotificationEvent} event
*/
notificationClick (event) {
const myurl = event.notification.data.url;
self.clients.openWindow(myurl);
event.notification.close();
},
/**
* Handle notification close event (Chrome 50+, Firefox 55+).
*
* https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/onnotificationclose
*
* @param {NotificationEvent} event
*/
notificationClose (event) {
},
/**
* Send notification to the user.
*
* https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification
*
* @param {PushMessageData|Object} data
*/
sendNotification (data) {
return self.registration.showNotification(data.title, data)
}
}
WebPush.init() })() ` this file for service worker I see not all files have the same error I don't know why .
Ah... ES6... Have a look at this issue. I don't think you can use YUI compressor for ES6.
... that reminds me that I have to add UglifyJS3.
Sorry that's not a solution, but right the only option is to use GCC.
@armin-pfaeffle ok thanks for your support 👍
minify not working always got this error
Thanks i