lxieyang / chrome-extension-boilerplate-react

A Chrome Extensions boilerplate using React 18 and Webpack 5.
MIT License
3.42k stars 1.07k forks source link

i need tutorial about content-script on this repo #195

Open RixkiSSS opened 8 months ago

RixkiSSS commented 8 months ago

recently just try this repo for creating random extension for chrome (just learn new thing)

while some page I already tried, like popup, newtab, background script, but just look up the content-script that use original console log is not even running (checked on edge dev tool), the console log not even write anything...

what I already do: npm i npm run build <--- to build data load unpackaged extension on my edge // i dont get any console log

npm run build <-- i build again to make sure npm run start <-- this even build with hot reload load package again // still not getting console log

i've already check, the code is not hot reloaded on webpack config then I tried to reload package, and remove then re-add the package to browser but still no luck

this extension I intend to use on a production website (thru https, should i change the config use https ?), though I don't have any experience with webpack, then, just final one... can you explain me how the content-script can executed as expected ?

RixkiSSS commented 8 months ago

hmm... i think because I still learning, the code is able to run now... because it need to run when not using npm run start

but let me change the question then: why node module like web3 or else is cause errors, i think other module can cause error to extension... teach me how to add module so i able to create better extension...

BlakeHastings commented 7 months ago

I ran into a similar issue and found an error in the console suggesting the issue was caused by socketJS opening an unsafe connection on a page that uses SSL. I flipped https to true in the webserver.js file in the utils folder and everything seems to be working now. Perhaps give that a try if you are still stuck with this issue.

felixswang commented 3 months ago

Thanks @BlakeHastings! Worked for me.