I'm trying to implement some logic in SW and faced the issue after I build my production version. In console I see the error "Uncaught SyntaxError: Cannot use import statement outside a module".
What i'm doing in custom worker is
/* eslint-disable no-undef */
import { myFunc } from '~/services/myFunc'
myFunc.is('something', true, () => {
importScripts(
'https://xxx.xxxxxx.com/YYYYYYYY.js'
)
})
in nuxt.config.js I add this worker:
workbox: {
importScripts: ['custom-worker.js']
}
Tried to do a research and what I found that importScripts() doesn't support import modules.
Is there any solution to fix it?