Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed web_accessible_resources in generated manifest.json #177

Closed
karaggeorge opened this issue Sep 12, 2024 · 1 comment · Fixed by #178
Closed

Malformed web_accessible_resources in generated manifest.json #177

karaggeorge opened this issue Sep 12, 2024 · 1 comment · Fixed by #178

Comments

@karaggeorge
Copy link
Contributor

I have a content script with the following definition:

"content_scripts": [
    {
      "matches": [
        "http://localhost:3000/my-path"
      ],
      "all_frames": true,
      "run_at": "document_end",
      "js": ["src/content-script.ts"]
    },

When I try to run extension dev, I get the following error:

Failed to load extension from: {path-to-extension}/dist/chrome. Invalid value for 'web_accessible_resources[1]'. Invalid match pattern.

Inspecting the resulting manifest, I see this declaration:

"web_accessible_resources": [
    ...
    {
      "resources": [
        "content_scripts/content-0.css",
        "content_scripts/content-1.css"
      ],
      "matches": [
        "http://localhost:3000/my-path"
      ]
    }
  ]

The Chrome docs say that the path needs to always be /*:

An array of strings, each containing a match pattern that specifies which sites can access this set of resources. Only the origin is used to match URLs. Origins include subdomain matching. Google Chrome emits an "Invalid match pattern" error if the pattern has a path other than '/*'.

I think the extension copies over the matches patterns that have a path defined, without removing it or replacing it with /*

@karaggeorge
Copy link
Contributor Author

I think this fixes it: #178

At least it fixed it locally for my case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant