crxjs / chrome-extension-tools

Bundling Chrome Extensions can be pretty complex. It doesn't have to be.
https://crxjs.dev/vite-plugin
2.96k stars 190 forks source link

error when starting dev server: TypeError: (0 , import_vite_plugin.crx) is not a function #939

Open twicer-is-coder opened 3 weeks ago

twicer-is-coder commented 3 weeks ago

Build tool

Rollup

Where do you see the problem?

Describe the bug

Everything was working fine until chrome released 130 and caused chaos with CSP. However I have upgraded the CRXJS package to "@crxjs/vite-plugin": "^2.0.0-beta.26" which have a fix for it. When I am starting the vite dev server, I am getting this error:

failed to load config from XX\vite.config.ts Error when starting dev server: TypeError: (0 , import_vite_plugin.crx) is not a functions

Any advise or workaround? I need to ship it ASAP as my extension is not working on production for many users.

Reproduction

Install ver 2.0.0-beta.26 and npm run dev.

Logs

No response

System Info

Windows 11, Chrome 130

Severity

blocking all usage of RPCE

jacksteamdev commented 3 weeks ago

@twicer-is-coder This looks like an import error in your config file, but it's hard to tell without more background.

  1. Can you provide your config file as a minimum repro?
  2. What was your last CRXJS version?
promethyttrium commented 3 weeks ago

add "type": "module" to your package.json

abdullah-tsx commented 3 weeks ago

was facing the same issue. fixed it by updating following "@crxjs/vite-plugin": "^2.0.0-beta.28" "vite": "5.4.6"

Nantris commented 2 weeks ago

None of these solutions make a difference. crxjs seems unusable at this time.

The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
failed to load config from redacted/packages/extension/vite.config.js
error when starting dev server:
TypeError: (0 , import_vite_plugin.crx) is not a function
rahulbansal16 commented 4 days ago

How did you resolve this? @Nantris

Nantris commented 4 days ago

I didn't. I moved to WXT.

rahulbansal16 commented 18 hours ago

I don't have bandwidth to change the framework for my project. My project is running on Keep The Light Mode on.

Nantris commented 15 hours ago

Ah yeah, sorry - I had just started out. There's no version you can roll back to and removing node_modules doesn't work I guess?

rahulbansal16 commented 13 hours ago

There are changes in the chrome browser which requires new changes https://github.com/crxjs/chrome-extension-tools/pull/928 It started happening after I downloaded the new version.