Skip to content

Content script entry chunk doesn't need to be web_accessible_resources #1130

@ylemkimon

Description

@ylemkimon

Build tool

Vite

Where do you see the problem?

  • In the browser
  • In the terminal

Describe the bug

The entry chunk of a content script doesn't need to be in web_accessible_resources, since it is loaded by the browser. This unnecessarily exposes the content script to the page.

Reproduction

  1. Run
npx create-crxjs@latest -t vanilla crxjs-test
cd crxjs-test
npm install
npm run build
  1. Check dist/manifest.json
{
  ...
  "content_scripts": [
    {
      "js": [
        "assets/main.js-DSyJgt1-.js"
      ],
      "matches": [
        "https://*/*"
      ]
    }
  ],
  ...
  "web_accessible_resources": [
    {
      "matches": [
        "https://*/*"
      ],
      "resources": [
        "assets/main.js-DSyJgt1-.js"
      ],
      "use_dynamic_url": false
    }
  ]
}

Logs

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 9700X 8-Core Processor
    Memory: 34.37 GB / 61.60 GB
  Binaries:
    Node: 24.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.4.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 145.0.7632.119
    Edge: Chromium (145.0.3800.70)
    Firefox: 148.0 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @crxjs/vite-plugin: ^2.0.3 => 2.3.0
    vite: ^7.0.5 => 7.3.1

Severity

annoyance

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions