카테고리 없음

webpack-bundle-analyzer에서 parsed, gzip이 안보이고 오로지 stat 만 보일때 해결 방법

YG - 96년생 , 강아지 있음, 개발자 희망 2023. 9. 21. 13:01

 

 

webpack-bundle-analyzer

 

GitHub - webpack-contrib/webpack-bundle-analyzer: Webpack plugin and CLI utility that represents bundle content as convenient in

Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap - GitHub - webpack-contrib/webpack-bundle-analyzer: Webpack plugin and CLI utility that repr...

github.com

 

 

이유는 webpack-derServer을 이용하고 있기 때문인데요 

 

에러 메세지

No bundles were parsed. Analyzer will show only original module sizes from stats file.

stat만 보이는 모습

 

 

해결 방법으로는 webpack-devServer을 사용하지 않으면 됩니다

 

webpack.analyzer.js

const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const { merge } = require('webpack-merge');

const common = require('./webpack.common.js');

module.exports = merge(common, {
  plugins: [new BundleAnalyzerPlugin()],
  mode: 'production', // 현재 배포 모드
  devtool: 'hidden-source-map', // 느리지만 안전 배포에 추천
});

 

package.json

  "scripts": {
    ...,
    "check-bundle": "webpack --config webpack.analyzer.js"
  },

 

적용 후 잘 나오는 모습