I am trying to make a chrome application and want to use the livereload so as to automatically update my when I make changes. But I am getting the following message —
Error Message:
Refused to load the script 'http://localhost:35729/livereload.js' because it violates the following Content Security Policy directive: "default-src 'self' chrome-extension-resource:". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
I added the following section in my manifest.json file but then chrome started giving a warning.
"content_security_policy": "script-src 'self' 'http://127.0.0.1:1337/livereload.js'; object-src 'self'"
Warning -
here were warnings when trying to install this extension: 'content_security_policy' is only allowed for extensions and legacy packaged apps, and this is a packaged app.
UPDATE:
The issue arises when I use a background script to create the window. ie when I have this in my manifest file
"background": {
"scripts": ["backgound.js"]
},
"content_security_policy": "script-src 'self' http://localhost:1337/livereload.js 'unsafe-eval'; object-src 'self'"
In case I don't use a background script, instead use this -
"app": {
"launch": {
"local_path": "window.html"
}
Then everything works just fine. Can someone please explain why is this happening?