closure-compiler
closure-compiler copied to clipboard
How to tell closure compiler that a web worker is usded in a project
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
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.
@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?
I use Service Worker