adambullmer / vue-cli-plugin-browser-extension

Browser extension development plugin for vue-cli 3.0
GNU Lesser General Public License v3.0
427 stars 76 forks source link

fix(csp): define global as 'window' to prevent CSP issues #110

Closed Kocal closed 10 months ago

Kocal commented 3 years ago

Hey :wave:

@t-miller faced an issue on https://github.com/Kocal/vue-web-extension/issues/658, with the usage of Function() and eval() in the dist code, complying with Mozilla' CSP when uploading the extension on their web store.

I fixed the same issue in a previous version of my preset (see https://github.com/Kocal/vue-web-extension/pull/398), and so I'm applying it here to impact more people.

I used .tap() to update DefinePlugin arguments, which is always configured by Vue-CLI.

Here is the output of vue-cli-service inspect: image