LoginSignup
2
1

More than 5 years have passed since last update.

ParcelでTypeScriptを扱ったらES5になってしまうとき

Last updated at Posted at 2018-10-04
  • Parcel v1.10.1
  • Node v10.11.0

Chromeで動けばいいアプリを、Parcelでbundleして出力を見たら、varと言っている

まず、Parcelは何でも屋。デフォルトでbabelを実行する。デフォルトのbrowserslist>0.25%(!?)らしい。

無駄が多すぎるのでlast 2 chrome versionsにしたが結果が変わらない。

原因

tsconfig.jsonが"extends"を使っていると、Parcelが解決できず、親のtsconfigにある"target": "esnext"を読んでくれない。

解決策

どうやら"extends"を諦めてコピペするしかなさそう・・・
https://github.com/parcel-bundler/parcel/pull/646

追記:
見てみたら簡単に修正できたのでPRを投げてみた
https://github.com/parcel-bundler/parcel/pull/2109

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1