vite-plugin-comlink
vite-plugin-comlink copied to clipboard
Unexpected early exit with import.meta.url
Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:worker-import-meta-url) transform "F:/htmlcss/ppms-web-test/src/utils.ts"
error during build:
Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:worker-import-meta-url) transform "F:/htmlcss/ppms-web-test/src/utils.ts"
at EventEmitter.handleEmptyEventLoop (file:///F:/htmlcss/ppms-web-test/node_modules/rollup/dist/es/shared/node-entry.js:24753:20)
at Object.onceWrapper (node:events:627:28)
at EventEmitter.emit (node:events:525:35)
at process.<anonymous> (file:///F:/htmlcss/ppms-web-test/node_modules/rollup/dist/es/shared/node-entry.js:24747:55)
at process.emit (node:events:525:35)
at process._0x5638e9 [as emit] (C:\Users\user\.vscode\extensions\wallabyjs.console-ninja-0.0.105\out\buildHook\index.js:1:239521)
Please provide a full reproduction example!
I get this too when building for production. Vite Config: import { resolve } from 'path'; import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react-swc'; import { name, version } from './package.json'; import dts from 'vite-plugin-dts'; import tsConfigPaths from 'vite-tsconfig-paths'; import svgr from 'vite-plugin-svgr'; import { visualizer } from 'rollup-plugin-visualizer'; import { externalizeDeps } from 'vite-plugin-externalize-deps'; import { comlink } from 'vite-plugin-comlink';
export default defineConfig({
build: {
lib: {
entry: resolve('src', 'index.ts'),
name: 'testLib',
formats: ['es'],
fileName: (format) => index.${format}.js,
},
},
define: {
pkgJson: {
name,
version,
},
},
worker: {
plugins: [comlink()],
},
plugins: [comlink(), react(), svgr(), tsConfigPaths(), dts(), visualizer(), externalizeDeps()],
});
packages: "react": "^17.0.2", "react-dom": "^17.0.2", "vite": "^4.0.0", "vite-plugin-comlink": "^3.0.5",
Please provide a full reproduction example! (for example a reposetory on github)
https://github.com/arjunindia/vitejs-vite-ppmhcb
(I didn't use this plugin here, just comlink I made this to raise an issue on the vite repo)
It seems like a problem with vite itself
The problem seems to be dependency looping - like utils.ts -> workers.ts -> utils.ts -> ...
https://github.com/vitejs/vite/issues/7015