crxjs / chrome-extension-tools

Bundling Chrome Extensions can be pretty complex. It doesn't have to be.
https://crxjs.dev/vite-plugin
2.9k stars 191 forks source link

MV3 Schema is missing world property for content scripts #741

Open TheColaber opened 1 year ago

TheColaber commented 1 year ago

Build tool

Rollup

Where do you see the problem?

Describe the bug

https://github.com/crxjs/chrome-extension-tools/blob/5bf6711ec75e74f31b22474a7465a72a052089e0/schema/manifest-v3.schema.json#L272 In the schema the property "world" is missing which is in the mv3 docs: https://developer.chrome.com/docs/extensions/mv3/content_scripts/#functionality

This property is pretty new: https://bugs.chromium.org/p/chromium/issues/detail?id=1330986

Currently when I use the property, it creates an error that an additional property exists and prevents any further execution.

Reproduction

.

Logs

.

System Info

.

Severity

blocking all usage of RPCE

Toumash commented 1 year ago

In vite i can add //@ts-ignoreand it starts the dev server fine (and adds it to the resulting manifest.json)

Unfortunately it does not matter since it cannot be loaded in the browser itself since mainworld scripts do not support chrome.runtime apis on which we depend for loading modules. Thats why jack blogged about it here with instruction. Theres also whole thread about it here #695. Does it work for you in rollup?

TypeError: Cannot read properties of undefined (reading 'getURL') at index.tsx-loader.js:9:24 at index.tsx-loader.js:20:5 at index.tsx-loader.js:22:3

Screenshots ![image](https://github.com/crxjs/chrome-extension-tools/assets/9840635/00a457dd-09f6-4d5c-827b-95ef95e35173) ![image](https://github.com/crxjs/chrome-extension-tools/assets/9840635/94dc510f-cd0c-490e-b6e0-985fc1ace975)