StarkShang / vite-plugin-chrome-extension

A vite plugin to bundle chrome extensions for Manifest V3.
MIT License
460 stars 68 forks source link

validate manifest content_security_policy error #11

Open defghy opened 3 years ago

defghy commented 3 years ago

content_security_policy needs string. It's different from doc.

[ { keyword: 'type', dataPath: '.content_security_policy', schemaPath: '#/definitions/content_security_policy/type', params: { type: 'string' }, message: 'should be string', schema: 'string', parentSchema: { type: 'string', description: 'This introduces some fairly strict policies that will make extensions more secure by default, and provides you with the ability to create and enforce rules governing the types of content that can be loaded and executed by your extensions and applications.', default: "script-src 'self'; object-src 'self'" }, data: { extension_pages: "script-src 'self'; object-src 'self'" } } ] [chrome-extension] There were problems with the extension manifest. error during build: ValidationError: There were problems with the extension manifest. at validateManifest (/Users/huyu/project/tools/ks-dc-kwaibi-chrome-ext/node_modules/.pnpm/vite-plugin-chrome-extension@0.0.7/node_modules/vite-plugin-chrome-extension/lib/index-cjs.js:1578:11) at ManifestProcessor.validateManifest (/Users/huyu/project/tools/ks-dc-kwaibi-chrome-ext/node_modules/.pnpm/vite-plugin-chrome-extension@0.0.7/node_modules/vite-plugin-chrome-extension/lib/index-cjs.js:2795:13) at ManifestProcessor.generateBundle (/Users/huyu/project/tools/ks-dc-kwaibi-chrome-ext/node_modules/.pnpm/vite-plugin-chrome-extension@0.0.7/node_modules/vite-plugin-chrome-extension/lib/index-cjs.js:2740:14) at async Object.generateBundle (/Users/huyu/project/tools/ks-dc-kwaibi-chrome-ext/node_modules/.pnpm/vite-plugin-chrome-extension@0.0.7/node_modules/vite-plugin-chrome-extension/lib/index-cjs.js:3284:13) at async Bundle.generate (/Users/huyu/project/tools/ks-dc-kwaibi-chrome-ext/node_modules/.pnpm/rollup@2.50.5/node_modules/rollup/dist/shared/rollup.js:13340:9) at async handleGenerateWrite (/Users/huyu/project/tools/ks-dc-kwaibi-chrome-ext/node_modules/.pnpm/rollup@2.50.5/node_modules/rollup/dist/shared/rollup.js:20719:23) at async doBuild (/Users/huyu/project/tools/ks-dc-kwaibi-chrome-ext/node_modules/.pnpm/vite@2.4.0-beta.2/node_modules/vite/dist/node/chunks/dep-06e8fbb4.js:51040:20) at async build (/Users/huyu/project/tools/ks-dc-kwaibi-chrome-ext/node_modules/.pnpm/vite@2.4.0-beta.2/node_modules/vite/dist/node/chunks/dep-06e8fbb4.js:50864:16) at async CAC. (/Users/huyu/project/tools/ks-dc-kwaibi-chrome-ext/node_modules/.pnpm/vite@2.4.0-beta.2/node_modules/vite/dist/node/cli.js:13995:9)

image https://developer.chrome.com/docs/extensions/mv3/mv3-migration-checklist/

eselkin commented 2 years ago

New schema for v3 is here: https://json.schemastore.org/chrome-manifest Not sure if you can just replace the one in this library or you'd have to do some work. Right now I have a modification that converts my string (passing the checking here) to the object above.