GoogleChromeLabs/worker-plugin

[question] Support service workers?

开放

#7 创建于 2018年10月1日

 (3 条评论) (3 个反应) (0 位负责人)JavaScript (88 个派生)batch import
enhancementgood first issuehelp wanted

仓库指标

星标
 (1,908 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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?

贡献者指南