Giter Site home page Giter Site logo

Comments (8)

pubkey avatar pubkey commented on May 19, 2024 1

I tried to fix this from the RxDB side but this was not really possible. I made a PR at the web-workers package so we might be able to fix it there: developit/web-worker#45

In the meantime you could build your worker file with webpack so it does not import the code it doesnt need. I added the webpack config that is used on the premium packages to the docs: 7a7fd5d#diff-b2b38c09cb3bf9d03ed981e79cdb62f75cf3c9e345e6bd7ab3356574b7fa9e12

from rxdb.

pubkey avatar pubkey commented on May 19, 2024 1

I checked out https://github.com/dmihal/Subworkers and this looks dangerous when used in multiple browser tabs that open and close randomly.
Notice that cross-worker communication is a performance bottleneck so using worker inside of your shared worker likely is slower then just using the shared worker and the subworkers package adds an additional layer of communication.

from rxdb.

pubkey avatar pubkey commented on May 19, 2024

Could reproduce your error.
You can debug the shared worker process by opening this url in chrome: chrome://inspect/#workers

I get the in-shared-worker error:

Uncaught ReferenceError: Worker is not defined
    at node_modules/web-worker/cjs/browser.js (rxdb-premium_plugins_storage-worker.js?v=7b25e094:24:22)
    at __require (chunk-LNEMQRCO.js?v=7b25e094:9:50)
    at rxdb-premium_plugins_storage-worker.js?v=7b25e094:461:33

Seems that the problem comes from the web-worker package
This is used inside of the getRxStorageWorker function, I will check.

from rxdb.

pubkey avatar pubkey commented on May 19, 2024

Seems to be a bundling problem because it somehow bundles the getRxStorageWorker methode inside of the worker where it should normally be tree shaked.

from rxdb.

ahoyahoy avatar ahoyahoy commented on May 19, 2024

https://chromestatus.com/feature/6080438103703552

Dedicated workers can create nested workers, but shared workers and service workers cannot.

Creating a nested dedicated worker from a shared worker is not yet supported.

Nested shared workers are also in the spec, but there is no plan to support them at this time.

from rxdb.

ahoyahoy avatar ahoyahoy commented on May 19, 2024

I misunderstood it and was looking for a solution for run a dedicated worker from a shared worker.
But I see now, if the web-worker does not return a Worker, it will not be necessary.
That's why I deleted my previous comments.
I wrote that you can use https://github.com/dmihal/Subworkers
But actually it only worked for me in dev mode (vite) and not after build.

from rxdb.

stale avatar stale commented on May 19, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. If you still have a problem, make a PR with a test case or to prove that you have tried to fix the problem. Notice that only bugs in the rxdb premium plugins are ensured to be fixed by the maintainer. Everything else is expected to be fixed by the community, likely you must fix it by yourself.

from rxdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.