Help us understand the problem. What is going on with this article?

LaravelのWebpackの速度改善

watchがおそすぎる

  • CPU負荷が常に大きい場合は監視対象が多すぎる可能性が高い
  • /node_modules/をwatchの監視対象から外す
webpack.mix.js
const mix = require('laravel-mix')
mix.webpackConfig({
  watchOptions: {
    ignored: /node_modules/
  }
})

参考:
WebpackでHot Module Replacementを使用する時のCPU使用率を改善する
How to ignore node_modules when running the watcher in Laravel Mix & Nuxt.js

コンパイルが遅い

  • HardSourcePluginをインストールする
# インストール
npm install --save hard-source-webpack-plugin

# アンインストールの場合
npm uninstall hard-source-webpack-plugin --save
webpack.mix.js
var HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
mix.webpackConfig({
    plugins: [
        new HardSourceWebpackPlugin()
    ]
})

参考:
Webpackのコンパイル速度改善HardSourcePlugin

Te2
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした