StarkShang / vite-plugin-chrome-extension

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

Unable to fix 'unsafe-eval' problem on Manifest V3 #9

Open inakineitor opened 3 years ago

inakineitor commented 3 years ago

Hello! First of all, thank you for making such a useful tool!

I was previously using a create-react-app boilerplate modified to create an extension and everything worked find but took to much time to compile and worked with MV2, not 3.

I decided to change to Vite (and use this plugin) to increase the compile speed and to allow for the use of the --watch flag in the future. Configuring everything went well, and I was able to render empty options and popup pages successfully. The problem arose when I started to bring all the components back from my previous repo to the vite one.

Everything was displaying correctly until one of the components caused this error on the popup screen: image

This made the screen not render anything JS related, effectively leaving the popup empty.

Manifest V3 doesn't allow for the content policy to be set to allow 'unsafe-eval' of popup scripts, so I am looking for an alternative solution. The create-react-app project didn't require the content policy to be changed from the default though, so I believe that is not the only solution.

I look forward to any insight that you may provide and will gladly provide any relevant information I missed. :)

Half-A-Turnip commented 2 years ago

@inakineitor maybe webpack "devtool: false"