-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
Description
I'm trying to use this library with Babel and TypeScript, but I'm getting a weird error.
// queue.worker.ts
import { TrackData } from "modules/track/types"
import { shuffleArray } from "common/lang/array/helpers/shuffleArray"
export async function getShuffledTracks(tracks: TrackData[], active: number) {
return shuffleArray(tracks).sort((track) => (track.id === active ? -1 : 0))
}
// somewhere.ts
import * as QueueWorker from "../queue.worker"
const worker = (QueueWorker as any)() as typeof QueueWorker
// somewhere in the file
await worker.getShuffledTracks(...)
Then, when the function is called, I get this error:
This is what the config for the loader looks like:
const workerRule = {
test: /\.worker\.ts$/,
use: [
"workerize-loader",
{
loader: "babel-loader",
options: {
presets: [
[
"@babel/env",
{
modules: false,
},
],
],
},
},
],
}