Skip to content

Since you can't pass a library or function to the run function, is there a way to import it inside the run function? #20

Description

@Evertt

I tried this:

Worker.run(async (batchPatch) => {
    const { useBatchesApi } = await import("@/hooks/useBatches")
    const { update } = useBatchesApi()
    return update(batchPatch)
  }, [batchPatch])
  .then(console.log)
  .catch(console.error)

But then I get Failed to resolve module specifier '/src/hooks/useBatches.ts?t=1649663469345'. I've been trying for hours now just to make the update method work. Please tell me there's a way to do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions