developit / developit/workerize-loader

ReferenceError: regeneratorRuntime is not defined

Abierto
#71 4 comentarios 0 reacciones 0 asignados Ver en GitHub
documentation question
Lenguaje dominante
JavaScript
Estrellas
2.3k
Forks
85
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I'm trying to use this library with Babel and TypeScript, but I'm getting a weird error.

```ts
// 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))
}
```

```ts
// 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:
![image](https://user-images.githubusercontent.com/5295397/61249686-31709a80-a756-11e9-813d-1448ffaf1b33.png)

This is what the config for the loader looks like:
```js
const workerRule = {
test: /\.worker\.ts$/,
use: [
"workerize-loader",
{
loader: "babel-loader",
options: {
presets: [
[
"@babel/env",
{
modules: false,
},
],
],
},
},
],
}
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.