chrome-extension-boilerplate-react-vite icon indicating copy to clipboard operation
chrome-extension-boilerplate-react-vite copied to clipboard

Trying to load "assets/js/index.js" & "assets/js/jsx-runtime.js" from web page itself

Open deld123 opened this issue 1 year ago • 1 comments

Hello, thanks for the great boilerplate.

Everything works seamlessly, but I see 2 errors in the console. Looks like trying to load assets/js/index.js & assets/js/jsx-runtime.js from web page itself instead from extension.

Screenshot of github.com/...'s console. image

Refused to load the script 'https://github.com/assets/js/index.js' because it violates the following Content Security Policy directive: "script-src github.githubassets.com". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

Refused to load the script 'https://github.com/assets/js/jsx-runtime.js' because it violates the following Content Security Policy directive: "script-src github.githubassets.com". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

Thank you for your help.

deld123 avatar Aug 02 '22 03:08 deld123

Thank you for your contribution. We will check and reply to you as soon as possible.

github-actions[bot] avatar Aug 02 '22 03:08 github-actions[bot]

Have the same problem( my manifest

{
  "manifest_version": 3,
  "name": "name",
  "version": "3.0.0",
  "description": "description",
  "homepage_url": "https://homepage_url",
  "options_page": "src/pages/options/index.html",
  "background": {
    "service_worker": "src/pages/background/index.js",
    "type": "module"
  },
  "action": {
    "default_title": "default_title",
    "default_icon": "logo-48.png"
  },
  "icons": {
    "128": "logo-128.png"
  },
  "content_scripts": [
    {
      "matches": [
        "http://*/*",
        "https://*/*",
        "<all_urls>"
      ],
      "js": [
        "src/pages/content/index.js"
      ]
    }
  ],
  "web_accessible_resources": [
    {
      "resources": [
        "assets/js/*.js",
        "src/pages/shared/*.js"
      ],
      "matches": [
        "*://*/*"
      ]
    }
  ],
  "permissions": [
    "storage",
    "tabs",
    "system.display"
  ],
  "content_security_policy": {
    "extension_pages": "script-src 'self'; object-src 'self'"
  }
}

ArtemEkzarho avatar Aug 03 '22 11:08 ArtemEkzarho

@deld123 @ArtemEkzarho

Thank you for contributing to the project through issues.

It has been identified as a problem with the interpretation of dynamic imports inside rollup. So I added custom plugin to fix dynamic import syntax to fix the issue.

  • https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite/pull/24

Would you like to check again with the latest version?

Jonghakseo avatar Aug 03 '22 14:08 Jonghakseo

#24 fixed the issue. Thank you very much 🙏

deld123 avatar Aug 08 '22 04:08 deld123

@all-contributors please add @deld123 for bug

Jonghakseo avatar Oct 15 '23 07:10 Jonghakseo

@Jonghakseo

I've put up a pull request to add @deld123! :tada:

allcontributors[bot] avatar Oct 15 '23 07:10 allcontributors[bot]