vitejs / vite-plugin-react-swc

Speed up your Vite dev server with SWC
MIT License
831 stars 54 forks source link

Using a `?sharedworker` import causes early exit during build. #120

Closed JarekToro closed 1 year ago

JarekToro commented 1 year ago

I found #23 but that seems to only apply to inline imports.

It runs without error when in dev. But running vite build causes this error:

Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:worker) transform "/path-to-project/file.sharedworker.ts?sharedworker"
    at process.handleBeforeExit (file:///path-to-project/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:25257:28)
    at Object.onceWrapper (node:events:626:26)
    at process.emit (node:events:511:28)
ArnaudBarre commented 1 year ago

Hi,

I just tested a basic example of using a shared worker, it works both in dev and build. Can you provide a small reproduction?

Why reproductions are required

JarekToro commented 1 year ago

It ended up being a circular dependency issue that was at the root of the shared worker problem. Not related to this plugin.