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

[components] Expose the worker in a specific file instead of inlining it? #15

Open
severo opened this issue Nov 7, 2024 · 3 comments
Open
Labels
question Further information is requested

Comments

@severo
Copy link
Contributor

severo commented Nov 7, 2024

The worker is currently inlined (base64):

import ParquetWorker from './parquetWorker?worker&inline'

The result from npm run build:

> @hyparam/[email protected] build
> tsc && vite build

vite v5.4.10 building for production...
✓ 42 modules transformed.

[vite:dts] Start generate declaration files...
computing gzip size (0)...[vite:dts] Declaration files built in 2095ms.

dist/index.es.js  237.16 kB │ gzip: 124.11 kB │ map: 128.20 kB
dist/index.umd.js  225.50 kB │ gzip: 122.69 kB │ map: 124.80 kB
✓ built in 2.83s

The alternative is to remove &inline. In this case, the result of npm run build is:

> @hyparam/[email protected] build
> tsc && vite build

vite v5.4.10 building for production...
✓ 42 modules transformed.

[vite:dts] Start generate declaration files...
dist/assets/parquetWorker-KNlj7o13.js  145.82 kB
dist/index.es.js                        42.16 kB │ gzip: 12.44 kB │ map: 128.00 kB
[vite:dts] Declaration files built in 2181ms.

dist/index.umd.js  30.63 kB │ gzip: 11.03 kB │ map: 124.65 kB
✓ built in 2.92s

But it means the users must serve the worker file in their app, which means docs + support.

@severo severo added the question Further information is requested label Nov 7, 2024
@severo severo changed the title [components] Expose the worker in a specific file instead of inlining it [components] Expose the worker in a specific file instead of inlining it? Nov 7, 2024
@severo
Copy link
Contributor Author

severo commented Nov 7, 2024

refs:
vitejs/vite#15547
vitejs/vite#7352

@severo severo changed the title [components] Expose the worker in a specific file instead of inlining it? [utils] Expose the worker in a specific file instead of inlining it? Nov 20, 2024
@severo
Copy link
Contributor Author

severo commented Nov 20, 2024

@severo severo changed the title [utils] Expose the worker in a specific file instead of inlining it? [components] Expose the worker in a specific file instead of inlining it? Nov 25, 2024
@severo
Copy link
Contributor Author

severo commented Nov 26, 2024

Also see https://github.com/surma/rollup-plugin-off-main-thread (seen in https://www.npmjs.com/package/microbundle#building-module-workers), in particular look at the gist which shows the result:

https://gist.github.com/surma/a02db7b53eb3e7870bf539b906ff6ff6


Also (unrelated): should we look at https://github.com/GoogleChromeLabs/comlink? It removes the need to use postMessage... Not sure if it's a good idea to add this extra-layer though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant