GoogleChromeLabs/worker-plugin

[question] Support service workers?

Open

#7 ouverte le 1 oct. 2018

Voir sur GitHub
 (3 commentaires) (3 réactions) (0 assignés)JavaScript (88 forks)batch import
enhancementgood first issuehelp wanted

Métriques du dépôt

Stars
 (1 908 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

I know this is specific to web workers, however I think this could be adapted to work for service workers. I was looking to create a separate plugin but the code would be mostly the same.

Looks like it scans the AST for a keyword (Worker) and generates an entry for the referenced file.

// web worker
new Worker('./foo.js', { type: 'module' })

// service worker
navigator.serviceWorker.register('./foo.js', { type: 'module' })

Could it be adapted to be more generic or am I missing something specific this does for web workers?

Guide contributeur