developit / developit/microbundle

--format=modern still converts modern JS to old-style JS?

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

説明

I was trying to figure out why my code was doing the wrong thing, and ran into the fact that using `--format=modern` still seems to yield legacy JS:

```
> microbundle watch -i ./src/react-app/ui.js -o ./public/preact-ui.js --format=modern --no-sourcemap --no-compress
```

turned the following:

```js
class MJUI extends Component {
constructor(props) {
// ...
}

renderGames(state) {
return state.games.map((g) => {
if (g.finished) return;

let joinOrStart = async () => {
// Note that these two operations are mutually
// exclusive, because owner's can't join, and
// non-owners can't start a game:
this.server.game.join(g.name);
this.server.game.start(g.name);
};

// ...
});
}

// ...
}
```

into:

```js
// ...

renderGames(state) {
var _this = this;

return state.games.map(g => {
if (g.finished) return;

let joinOrStart = async function joinOrStart() {
// Note that these two operations are mutually
// exclusive, because owner's can't join, and
// non-owners can't start a game:
_this.server.game.join(g.name);

_this.server.game.start(g.name);
};

// ...
```

Note that the filename has the `.modern.js` suffix, so something feels rather off?

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

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

評価

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

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

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