Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,15 @@ The `hyperparam` package also includes a library that can be used in other appli
```js
import { asyncBufferFrom, AsyncBufferFrom, parquetDataFrame } from "hyperparam";
```

If you encounter any issues with the web worker, you might have to configure your bundler. For example, in Vite, you can use the following configuration:

```js
import { defineConfig } from "vite";
export default defineConfig({
...
optimizeDeps: {
exclude: ["hyperparam"],
},
});
```
5 changes: 1 addition & 4 deletions src/lib/workers/parquetWorkerClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import ParquetWorker from './parquetWorker?worker&inline'
/// ^ the worker is bundled with the main thread code (inline) which is easier for users to import
/// (no need to copy the worker file to the right place)
import type { ColumnData } from 'hyparquet'
import type { ClientMessage, WorkerMessage, WorkerOptions } from './types.js'

Expand All @@ -16,7 +13,7 @@ const pending = new Map<number, QueryAgent>()

function getWorker() {
if (!worker) {
worker = new ParquetWorker()
worker = new Worker(new URL('./parquetWorker.js', import.meta.url), { type: 'module' })
worker.onmessage = ({ data }: { data: WorkerMessage }) => {
const pendingQueryAgent = pending.get(data.queryId)
if (!pendingQueryAgent) {
Expand Down
1 change: 1 addition & 0 deletions vite.lib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ export default defineConfig({
},
sourcemap: true,
},
base: './',
})