Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker with import is failing to build since alpha.5 #8479

Closed
kalvenschraut opened this issue Jun 6, 2022 · 9 comments
Closed

Worker with import is failing to build since alpha.5 #8479

kalvenschraut opened this issue Jun 6, 2022 · 9 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@kalvenschraut
Copy link

Describe the bug

I am going through the process of a major refactor into a monorepo for my company's code base and ran into the below issue when running vite build on alpha.8 and later while it builds successfully on alpha.7. I don't have a minimal reproduction yet, may be easier for me to debug off my codebase and attempt a PR if possible, but wanted to make an issue to see if the output was helpful or if I could be given direction to look into this issue.

Reproduction

tbd

System Info

System:
    OS: Linux 5.15 Gentoo/Linux
    CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
    Memory: 8.20 GB / 18.71 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 16.13.1 - /usr/bin/node
    Yarn: 1.22.18 - ~/.local/share/pnpm/yarn
    npm: 8.6.0 - /usr/bin/npm
    Watchman: 2022.03.21.00 - /usr/bin/watchman
  Browsers:
    Firefox: 91.7.0esr
  npmPackages:
    @vitejs/plugin-vue: 3.0.0-alpha.1 => 3.0.0-alpha.1
    vite: 3.0.0-alpha.8 => 3.0.0-alpha.8

Used Package Manager

pnpm

Logs

transforming (171) src/assets/layouts/GridTwoEqualColumns.ymlUnexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/vue.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/vuex.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/vue-router.js"
(vite:worker) transform "/home/kalvens/rtvision-app/mono/apps/app-ui/src/workers/IndexdbWorker.ts?worker"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/ajv.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/ajv-formats.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/fast-copy.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/mathjs.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/luxon.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/number-to-words.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/string-similarity.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/insane.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/hash-sum.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/marked.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/localforage.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/localforage-getitems.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/localforage-setitems.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/ol_tilecoord.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/@quasar_extras_mdi-v6.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/pako.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/papaparse.js"
error during build:
Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/vue.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/vuex.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/vue-router.js"
(vite:worker) transform "/home/kalvens/rtvision-app/mono/apps/app-ui/src/workers/IndexdbWorker.ts?worker"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/ajv.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/ajv-formats.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/fast-copy.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/mathjs.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/luxon.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/number-to-words.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/string-similarity.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/insane.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/hash-sum.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/marked.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/localforage.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/localforage-getitems.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/localforage-setitems.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/ol_tilecoord.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/@quasar_extras_mdi-v6.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/pako.js"
(vite:optimized-deps-build) load "/home/kalvens/rtvision-app/mono/apps/app-ui/node_modules/.vite/deps_build/papaparse.js"
    at EventEmitter.handleEmptyEventLoop (file:///home/kalvens/rtvision-app/mono/node_modules/.pnpm/rollup@2.75.5/node_modules/rollup/dist/es/shared/rollup.js:23152:20)
    at Object.onceWrapper (node:events:509:28)
    at EventEmitter.emit (node:events:402:35)
    at process.<anonymous> (file:///home/kalvens/rtvision-app/mono/node_modules/.pnpm/rollup@2.75.5/node_modules/rollup/dist/es/shared/rollup.js:23146:55)
    at process.emit (node:events:390:28)


### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
@kalvenschraut kalvenschraut changed the title Vitejs going from 3.0.0-alpha.7 to 3.0.0-alpha.8 is causing prod build failure Vite going from 3.0.0-alpha.7 to 3.0.0-alpha.8 is causing prod build failure Jun 6, 2022
@kalvenschraut
Copy link
Author

kalvenschraut commented Jun 7, 2022

Odd alpha.7 stopped working for me now and I had to roll back all the way to alpha.4

@patak-dev
Copy link
Member

patak-dev commented Jun 7, 2022

After:

Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit

is a sign that we are waiting for rollup to finish processing a file before starting to optimize dependencies, but the file processing is blocked by the deps itself. This shouldn't be the case, a minimal reproduction would be very valuable. If not, if you can debug, this is the new logic that is affecting you:

function runOptimizerWhenIdle(config: ResolvedConfig) {

And here:
delayDepsOptimizerUntil(config, id, () => request)

You can set optimizeDeps.devScan: true, but it would be good to avoid it as we are trying to deprecate/remove the scanner in v3.

Are you using workers in your project? Check this part if that is the case:

export function registerWorkersSource(

@kalvenschraut
Copy link
Author

kalvenschraut commented Jun 7, 2022

Thanks for the information!

I found out removing the worker import causes the build to succeed, and each build after that will continue to succeed until I remove everything under node_modules/.vite. I think this was the reason I was confused what version introduced the issue.

@patak-dev
Copy link
Member

Yes, you can also run it with --force that will clear the deps cache so you are always testing cold start. Looks like the registerWorkersSource scheme isn't working correctly. If you can create a minimal repro using a worker, I can debug it. Thanks! Or let me know how I can help if you'll try to debug it yourself.

@kalvenschraut
Copy link
Author

https://github.com/RtVision/vitejs-alpha-repro/tree/master repro created

@SebiTalent04
Copy link

SebiTalent04 commented Jun 7, 2022

Experiencing the same thing on 2.9.10
image

@patak-dev
Copy link
Member

@SebiTalent04 the error you're seeing doesn't seems related to this issue. Would you open a new bug report with a minimal reproduction? Thanks!

@kalvenschraut kalvenschraut changed the title Vite going from 3.0.0-alpha.7 to 3.0.0-alpha.8 is causing prod build failure Worker with import is failing to build since alpha.5 Jun 8, 2022
@patak-dev patak-dev added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Jun 8, 2022
@patak-dev
Copy link
Member

@kalvenschraut the fix for this issue has now been released in vite@3.0.0-alpha.10
Thanks for testing the alphas, let us know if anything else isn't working as expected

@kalvenschraut
Copy link
Author

Everything is working again as expected, trying to use the alpha for the import.meta changes.

Thanks for your prompt response and fix!

@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

3 participants