closure-compiler icon indicating copy to clipboard operation
closure-compiler copied to clipboard

How to tell closure compiler that a web worker is usded in a project

Open zuhairtaha opened this issue 2 years ago • 3 comments

I have a chrome extension project which has two folders, one is content-script which use dom the other one is background which uses service worker I would like to tell closure compiler which library/environment is used in each so that it give errors/warnings if I missused one of them

For example using window object or document.createElement in service woker should show an error

zuhairtaha avatar Dec 02 '22 08:12 zuhairtaha

Roughly the answer is to compile the 2 parts separately using different externs files (standard for the web page, worker externs only for the worker one). However, I don't have a handy list of which externs those are, and I suspect you're looking for a solution that compiles all of these things together.

Honestly, we've never spent any time trying to support this use-case. Sorry.

brad4d avatar Dec 07 '22 17:12 brad4d

@zuhairtaha I am afraid Service Worker and Web Worker are two very different things. Let's start by getting this straight. Which one are you trying to use?

fingerartur avatar Jan 11 '23 11:01 fingerartur

I use Service Worker

zuhairtaha avatar Jan 11 '23 12:01 zuhairtaha