Closed rahulbansal16 closed 1 year ago
Hi. Try to reload your extension
in chrome://extensions
It work for me
Have a nice day :)
I did reloading it did not work for me. I am worried How to deal with this if it happens at the production extension at some user browser?
If you are seeing "Waiting for service worker", it means that the extension is the development build. During development, Vite serves the background and extension page files from localhost, so Vite must be running in the terminal.
@rahulbansal16 When you run the build command, the production version of the extension will include the background files, so everything will work.
We should change the "Waiting..." message to guide the developer to either start Vite or run the build command.
This is a great first issue, anyone who is interested in contributing can start here: https://github.com/crxjs/chrome-extension-tools/blob/a8d567092f0cb4e27ce781d009e8e856cdae33b1/packages/vite-plugin/src/client/html/precontroller.html
@jacksteamdev I just started the npm run dev
and it started working. Thanks for your help.
Hello! I wanted to ask, why not wait for the service worker to be ready, and then reload the page?
This logic seems to be attempted here: https://github.com/crxjs/chrome-extension-tools/blob/a8d567092f0cb4e27ce781d009e8e856cdae33b1/packages/vite-plugin/src/client/es/page-precontroller-script.ts (close enough)
But for some reason it doesn't work?
Hi, I had get same error, and fixed like below....
server: {
https: {
key: fs.readFileSync('./localhost-key.pem'),
cert: fs.readFileSync('./localhost.pem'),
},
},
http
to https
in service-worker-loader.jsI guess, Chrome not permit to access via http in default. Can I have any way that fix this?
In my case, I build the dist from vite and then add a file in the web extension. After a review from google. the same issue arises.
At local it runs fine.
If I add a dist file in chrome in development mode it runs fine
what should steps I take to resolve this issue
I am guessing you have not done npm run build before publishing.
On Thu, Mar 23, 2023, 09:08 Nawaraj Jaishi @.***> wrote:
In my case, I build the dist from vite and then add a file in the web extension. After a review from google. the same issue arises. [image: image] https://user-images.githubusercontent.com/24637410/227095805-35aa860a-9256-4904-9483-e2be1529c825.png
At local it runs fine. [image: image] https://user-images.githubusercontent.com/24637410/227095924-0680125f-be69-402b-9a4d-07cc811b70e8.png
If I add a dist file in chrome in development mode it runs fine
what should steps I take to resolve this issue
— Reply to this email directly, view it on GitHub https://github.com/crxjs/chrome-extension-tools/issues/449#issuecomment-1480555739, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAS47MD3TT5UEILCSJJZ33W5PAT3ANCNFSM53C6UWTQ . You are receiving this because you were mentioned.Message ID: @.***>
This issue is still not resolved? Could you please advice on how to solve this? @jacksteamdev
The popup shows waiting for service worker. Service worker inactive.
Any solution appreciated.
@jacksteamdev, my case is similar @ivalsaraj 's . I would appreciate any solution
I've had this temperamentally and restarting chrome fixed it.
Same issue and I noticed there seems to be an issue loading the env in server-worker-loader
import 'http:/localhost:3000/@vite/env';
import 'http://localhost:3000/crx-client-worker';
It's built with http:/
missing the second forward slash. Anyone else seeing that? Built for vue.
in index.cjs on line 3518 loader =
import 'http:/localhost:${port}/@vite/env';`
Fixing that doesn't seem to resolve the issue. I get a cors error in chrome extension logs:
Access to script at 'http://localhost:3000/crx-client-worker' from origin 'chrome-extension://gcnpefeokmmfpfbihpigfjmiancnjnhi' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
found my issue. Had something running on port 3000 in docker. Vite is not port aware against non vite process' it seems.
In my case, this only happens when there's code in the background script. Emptying the background script stops the error which is quite weird.
In my case, it did not load service worker because file name was pascal-case.
AFAIK this happens when you have error in background script. Clear error then it will load as usual.
For anyone running into this issue, try doing npm run dev -- --host
.
For anyone running into this issue, try doing
npm run dev -- --host
.
This is the solution when your extension is running on a different port. A typical case when this happens is if you have another app already running on the default port 3000.
Probably FOUND a solution!
The issue reproduces with the following version: "@crxjs/vite-plugin": "^1.0.14"
.
But when I installed beta
version of the package — the issue have disappeared.
So, just run the following:
bun i -D @crxjs/vite-plugin@beta
(or using npm
/yarn
etc).
bun i -D @crxjs/vite-plugin@beta
This FIXED it for me. Thanks
Build tool
Vite
Where do you see the problem?
Describe the bug
Hi everyone,
I was following the CRXJS tutorial
https://crxjs.dev/vite-plugin/getting-started/react/create-project
for creating an extension using react.I was successfully able to create the extension. It was working perfectly and I let the extension stay in my browser without changing anything.
After 3-4 days I got an error on clicking the extension icon "Service worker has not loaded fully."
The service worker related to the extension is not shown in the chrome://inspect/#service-workers
Reproduction
https://crxjs.dev/vite-plugin/getting-started/react/create-project
Logs
No response
System Info
Severity
blocking all usage of RPCE