諸行無常

IT色々お勉強中のブログ

webpack3→4でエラーになった babel-core

babel-coreが読み込めないらしい

Error: Cannot find module '@babel/core'
 babel-loader@8 requires Babel 7.x (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.
yarn upgrade babel-core

こっちじゃダメだった

yarn add @babel/core --dev

こっちでいけた あかんやろ、開発以外にも反映せな

yarn add @babel/core
Move us to the @babel namespace by switching to using “scoped” packages (details). This helps differentiate official packages, so babel-core becomes @babel/core (and no squatting)

babel-coreから@babel/core に変わったらしい ので消した

yarn remove babel-core

.babelrcも変更

     "plugins": [
     "transform-runtime",
-    "syntax-dynamic-import",
-    "transform-object-rest-spread",
-    ["transform-class-properties", { "spec": true }]
+    "@babel/syntax-dynamic-import",
+    "@babel/plugin-proposal-object-rest-spread",
+    "@babel/plugin-proposal-class-properties"
   ]

新しいのに変更

babeljs.io

new.babeljs.io

Module build failed: TypeError: this.setDynamic is not a function · Issue #560 · babel/babel-loader · GitHub まだエラーが出るので修正

   "plugins": [
-    "transform-runtime",
+    "@babel/plugin-transform-runtime",
yarn add @babel/plugin-transform-runtime --dev
yarn add @babel/plugin-transform-runtime 

こっちもね インストール 続く