crxjs / chrome-extension-tools

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

@crxjs/vite-plugin doesn't work with the @sveltejs/kit/vite in dev mode #504

Open gprieto opened 2 years ago

gprieto commented 2 years ago

Build tool

Vite

Where do you see the problem?

Describe the bug

Currently the @crxjs/vite-plugin doesn't work with the @sveltejs/kit/vite.

Reproduction

Using the following vite.config.js on a simple SvelteKit project:

import { sveltekit } from '@sveltejs/kit/vite';
import type { UserConfig } from 'vite';
import { crx } from '@crxjs/vite-plugin';
import manifest from './manifest.json';

const config: UserConfig = {
    plugins: [
        sveltekit(),
        crx({ manifest }),
    ]
};

export default config;

and running npm run dev I get the following errors:

In the pop-up:

404
Not found: /index.html
Error: Not found: /index.html

In the extension tab:

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256-VNxJMG0FGk48qPJGcDVjmpIf6HybIYRibRlDmXSU2wc='), or a nonce ('nonce-...') is required to enable inline execution.

Severity

blocking all usage of RPCE

gprieto commented 2 years ago

Solved by solving #505