Node.jsプロジェクトでのES 6変換
706 ワード
ES 6の
babel依存のインストール
同時にプロジェクトルートディレクトリの下に
import
,export
,解構などをプロジェクトで使用したい場合は、関連babel依存をインストールできますbabel依存のインストール
npm install babel-core babel-cli babel-plugin-transform-es2015-destructuring babel-plugin-transform-es2015-modules-commonjs babel-plugin-transform-es2015-parameters babel-plugin-transform-es2015-spread babel-plugin-transform-strict-mode -D
同時にプロジェクトルートディレクトリの下に
.babelrc
ファイルを追加し、内容は以下の通りです.{
"plugins": [
"transform-strict-mode",
"transform-es2015-modules-commonjs",
"transform-es2015-spread",
"transform-es2015-destructuring",
"transform-es2015-parameters"
]
}