0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

laravel-mix 5→6 にバージョンアップしてハマりました。error: unknown option ‘--hide-modules’ [webpack-cli] Run ‘webpack --help’

Last updated at Posted at 2022-03-07

laravel mix をバージョンアップしたらハマったので黙示録

きっかけ

  1. 脆弱性チェック
    npm audit
  2. 脆弱性をみつけたので 愚かにも 何も考えずに
    npm audit fix --force
  3. 気づかずlaravel mixがアップデートされていたことに気づく
  4. 今後のためにも対応させたいと思い立つ
  5. はまる
    error: unknown option ‘--hide-modules’ [webpack-cli] Run ‘webpack --help’

改善方法の結論

  • package.jsonの scriptsの書式をlaravel-mix v6に合わせて編集
"scripts": {
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "production": "mix --production"
}
  • webpack.mix.jsをlaravel-mix v6に合わせて編集
mix.ts('resources/ts/app.tsx', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.react();  //ここ追加

教訓

  • npm audit fix --forceは安易に使わない
  • リファレンスを真っ先に探す

参照リソース

リファレンス

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?