Write Chrome extension with Webpack serve

Issue

This Content is from Stack Overflow. Question asked by superkinhluan

I’m writing a Chrome extension which extends the Developer tools. In the html page of my devtools panel, I want to use webpack in watch mode for fast iteration of the UI. In the extension manifest, I added this entry:

{
    "content_security_policy": {
        "extension_pages": "default_src: 'self' http://localhost:8081"
    }
}

Then in the html page, I specify my script src as:

<script src="http://localhost:8081/devtoolspane.html"></script>

Chrome happily loads my extension, but when it tries to load the html page, it fails with the following error:

Couldn't load script from http://localhost:8081/devtoolspane.html because it doesn't meet the CSP rule.

What do I do wrong here?



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?