rettoua / angular-elements-chrome-extension-example

6 stars 5 forks source link

Using web-panel.js in another Extension project - In this configuration Angular requires Zone.js #1

Open jakubbares opened 4 years ago

jakubbares commented 4 years ago

Hey, Thank you so much for this effort. Very useful. I would like to use your project to generate a bundled set of components to use in my Angular Chrome Extension. I however get an error "In this configuration Angular requires Zone.js" when I execute the content script where I load the bundled web-panel.js like below. I have not modified the web-panel.js so far. I find it weird there is this error since in elements-build.js the polyfills are included and zone.js is there

let s = document.createElement('script');
s.type = 'text/javascript';
s.src = chrome.extension.getURL('web-panel.js');
s.onload = function() {
  const panel = document.createElement('custom-element');
  try {
    document.body.innerHTML = panel.outerHTML;
  } catch (e) {
    console.log(e);
  }
};
try {
  (document.head || document.documentElement).appendChild(s);
} catch (e) {
  console.log(e);
}
samfrach commented 3 years ago

I have the same problem... did you solve it ?

samfrach commented 3 years ago

I have added zone.js the same as web-panel.js and it works

BobbyTable commented 3 years ago

I have added zone.js the same as web-panel.js and it works

Exactly what steps did you go through to achieve this? Ive put zone.js that i found in node_modules/zone/dist in the same folder as manifest and web-panel.js, and added it to manifest.json section web_accessible_resources without luck.

EDIT: For anyone looking, do my steps above, and also inject zone.js via a Githubissues.

  • Githubissues is a development platform for aggregating issues.