OpenSwitchMaps icon indicating copy to clipboard operation
OpenSwitchMaps copied to clipboard

Migration to Manifest v3

Open limex opened this issue 3 years ago • 5 comments

Hi, any plans to migrate to manifest v3 in the near future? BR Günther

limex avatar Oct 10 '22 11:10 limex

Well I'm reading what is version 3. I'll try.

tankaru avatar Oct 10 '22 11:10 tankaru

I failed to migrate to manifest version 3, because of my poor knowledge for npm/package/manifest.

For version 2, manifest.json is here.

{
	"manifest_version": 2,
	"background": {
	  "scripts": ["background.js"]
	},
	...
}

And build works fine.

C:\work\OpenSwitchMaps>npm run build

> [email protected] build C:\work\OpenSwitchMaps
> parcel build src/manifest.json

√  Built in 4.60s.

dist\popup.875c8b0d.js.map      ‼  1.33 MB    116ms
dist\options.00631928.js.map    ‼  1.32 MB    116ms
dist\background.js.map           865.23 KB     79ms
dist\popup.875c8b0d.js           241.27 KB    568ms
dist\options.00631928.js         239.51 KB    567ms
dist\background.js               150.11 KB    512ms
dist\icon128.png                   5.13 KB     48ms
dist\popup.d8ea6438.css              790 B     27ms
dist\manifest.json                   546 B     26ms
dist\options.0e5cdf52.css            298 B     27ms
dist\options.html                    199 B     33ms
dist\popup.html                      193 B     33ms

Then I changed manifest.json like this.

{
	"manifest_version": 3,
	"background": {
	  "service_worker": "background.js"
	},
	...
}

In this case "background.js" is not built.

C:\work\OpenSwitchMaps>npm run build

> [email protected] build C:\work\OpenSwitchMaps
> parcel build src/manifest.json

√  Built in 837ms.

dist\popup.875c8b0d.js.map      ‼  1.33 MB    155ms
dist\options.00631928.js.map    ‼  1.32 MB    155ms
dist\popup.875c8b0d.js           241.27 KB    219ms
dist\options.00631928.js         239.51 KB    219ms
dist\icon128.png                   5.13 KB    363ms
dist\popup.d8ea6438.css              790 B     12ms
dist\manifest.json                   551 B     16ms
dist\options.0e5cdf52.css            298 B     12ms
dist\options.html                    199 B    355ms
dist\popup.html                      193 B     10ms

What's wrong with it?

tankaru avatar Oct 18 '22 22:10 tankaru

Well, v3 ist not just updating a 2 to a 3. V3 has additional mandatory security features. like mentioned here i.e. https://developer.chrome.com/docs/extensions/mv3/mv3-migration/ I tried to migrate the code in my fork, but failed so far because my JS/TS Knowledge is not so strong. i.e. the build complains about require() is not allowed and must be called inside a module. If you are using a Dev Environment like VS Code plus the necessary extensions for Vue, you should see plenty of errors.

limex avatar Oct 19 '22 05:10 limex

Hi, did you progress with the upgrade to MV3? I tried it with my fork https://github.com/limex/OpenSwitchMaps and failed so many times. This is how far I came: https://github.com/limex/OpenSwitchMaps-v3. No matter which strategy: TypeScript or stay at JavaScript, Vue3 or stay on Vue2, .... There are so many strange errors and dependencies .... I give up, I'm not a developer. Already spent 60+ hours on this.

limex avatar Aug 26 '23 13:08 limex

Unfortunately no progress. To be honest, I've switched to Firefox, so I'm not motivated enough to fix it.

tankaru avatar Aug 27 '23 10:08 tankaru