Closure Compiler Renaming Methods of External Libs

77 Views Asked by At

I am creating a Chrome extension and compiling it using closure compiler, specifically tscc

When I compile the code it's converting chrome.tabs.executeScript() into chrome.b.a() and causing it to throw the error

Uncaught (in promise) TypeError: Cannot read property 'a' of undefined

How do I prevent this from happening?

tscc.spec.json

{
  "modules": {
    "out": "src/background.ts"
  },
  "compilerFlags": {
    "language_out": "ECMASCRIPT_2019"
  },
  "external": {
    "chrome_extensions": "chrome"
  },
  "prefix": "dist/"
}
0

There are 0 best solutions below