3
2

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 3 years have passed since last update.

Docker環境のLaravelでlaravel-mix-bundle-analyzerを使う

Posted at

Docker環境では、デフォルト設定では使えなかったのでメモ

Laravel用のパッケージをインストール

インストールは手順通り。
https://www.npmjs.com/package/laravel-mix-bundle-analyzer

npm install laravel-mix-bundle-analyzer --save-dev

docker-composeの設定を変更

docker-compose.yml
version: '3'
services:
  web:
    ports:
      - 8080:8080
      - 8888:8888 // 追加

webpack.mix.jsに追加

ほとんどUsageに書いてある通り。
{analyzerHost: "0.0.0.0"}の部分を追加するだけ。

webpack.mix.js
const mix = require("laravel-mix");
require('laravel-mix-bundle-analyzer');

if (!mix.inProduction() && mix.isWatching()) {
  mix.bundleAnalyzer(
    {analyzerHost: "0.0.0.0"} // これ追加
  );
}

以上。

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?