GithubHelp home page GithubHelp logo

Comments (5)

Barabazs avatar Barabazs commented on June 10, 2024 1

I did some more debugging and it appears to be because of using the asterisk as an identifier in "matches": [ "*" ].
I just tried with <all_urls> and the extension runs correctly.

FYI, here's the output from addons-linter
Code                      Message                       Description                                      File            Line   Column
JSON_INVALID              "/content_scripts/0/matche…   Your JSON file could not be parsed.                                           
                          s/0" should be equal to one                                                                                 
                          of the allowed values                                                                                       
JSON_INVALID              "/content_scripts/0/matche…   Your JSON file could not be parsed.                                           
                          s/0" should match pattern                                                                                   
                          "^(https?|wss?|file|ftp|\*…                                                                                 
                          )://(\*|\*\.[^*/]+|[^*/]+)…                                                                                 
                          /.*$"                                                                                                       
JSON_INVALID              "/content_scripts/0/matche…   Your JSON file could not be parsed.                                           
                          s/0" should match pattern                                                                                   
                          "^file:///.*$"                                                                                              
JSON_INVALID              "/content_scripts/0/matche…   Your JSON file could not be parsed.                                           
                          s/0" is not a valid key or                                                                                  
                          has invalid extra                                                                                           
                          properties                                                                                                  
JSON_INVALID              "/content_scripts/0/matche…   Your JSON file could not be parsed.                                           
                          s/0" should match pattern                                                                                   
                          "^resource://(\*|\*\.[^*/]…                                                                                 
                          +|[^*/]+)/.*$|^about:"                                                                                      

from web-ext-react.

mrloop avatar mrloop commented on June 10, 2024

Can you post the whole extension/manifest.json file, or even better your project and I can take a look.

from web-ext-react.

Barabazs avatar Barabazs commented on June 10, 2024

Right now I'm trying to use your example from web-ext-react-hello and build on that.

The only changed files are:

extension/manifest.json
{
  "description": "Bundle ReactJS as web extension",
  "manifest_version": 2,
  "name": "web-ext-react-hello",
  "version": "1.0",
  "homepage_url": "https://github.com/mrloop/web-ext-react-hello",
  "icons": {
    "192": "logo192.png"
  },
  "browser_action": {
    "default_icon": "logo192.png",
    "default_title": "Hello WebExt",
    "default_popup": "popup.html"
  },
  "content_scripts": [
    {
      "matches": [
        "*"
      ],
      "js": [],
      "css": []
    }
  ],
  "background": {
    "page": "background-page.html"
  }
}
src/index.js
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";

if (document.isBackground) {
  // some background script
  console.log("Background script");
} else if (document.isBrowserAction) {
  ReactDOM.render(
    <React.StrictMode>
      <App />
    </React.StrictMode>,
    document.getElementById("root")
  );
} else if (document.isContentScripts) {
  console.log("I'm a content script");
}

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();

from web-ext-react.

mrloop avatar mrloop commented on June 10, 2024

Thanks @Barabazs have updated docs

from web-ext-react.

Barabazs avatar Barabazs commented on June 10, 2024

Thanks!

from web-ext-react.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.