Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

422
Vistas
Nuxt.js Service Worker Uncaught SyntaxError: Cannot use import statement outside a module

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?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda