developit / developit/workerize-loader

ReferenceError: regeneratorRuntime is not defined

オープン
#71 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
documentation question
主要言語
JavaScript
スター
2.3k
フォーク
85
PR マージ指標
30日以内にマージされた PR はありません

説明

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,
},
],
],
},
},
],
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。