ChromeExtension-GoogleDocsUtil icon indicating copy to clipboard operation
ChromeExtension-GoogleDocsUtil copied to clipboard

How to integrate with modulization introduced by PR #11?

Open menicosia opened this issue 5 years ago • 4 comments

Hello! I am trying to take advantage of the improvements in recent PRs, but I am blocked by the change introduced by PR #11 where the main file was transformed into a module.

Previous behavior:

  • Load googleDocsUtil.js via the extension's manifest.json:

    "content_scripts": [
       {
         "js": ["googleDocsUtil.js", "receiver.js"],
    

Current behavior:

  • When I try to load googleDocsUtil.js in that way, I get this error from Chrome:

    googleDocsUtil.js:1 Uncaught SyntaxError: Unexpected token 'export'

As a result of this change, I don't know how to access the module from within a Chrome extension. Specifically, I need googleDocsUtil.js to load into the page that I am currently viewing, and the only way I know how to do that is via a content script, which does not accept a Javascript module. There is no way to import or require the file because, without this content script loading, the file is not available to my extension.

Since I am stuck, the only change I can think to suggest is to roll-back the module-ness of PR #11? Are there other options?

/cc @bdvorianov

menicosia avatar Oct 30 '19 22:10 menicosia