pajecawav / next-statoscope

Use statoscope in your Next.js project.
MIT License
3 stars 0 forks source link

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory #4

Open prof-awais opened 2 weeks ago

prof-awais commented 2 weeks ago

image

image

My next Js config

import nextMDX from "@next/mdx";
import withStatoscope from "next-statoscope";
import remarkGfm from "remark-gfm";

/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "avatown.s3.us-east-1.amazonaws.com",
      },
      {
        protocol: "https",
        hostname: "dvsidzhlgjuah.cloudfront.net",
      },
      {
        protocol: "https",
        hostname: "d39s7djqnckq05.cloudfront.net",
      },
    ],
    deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
  },

  // mui
  modularizeImports: {
    "@mui/material": {
      transform: "@mui/material/{{member}}",
    },
    "@mui/icons-material": {
      transform: "@mui/icons-material/{{member}}",
    },
    /* "@/components": {
      transform: "src/components/{{member}}",
    }, */
  },

  // webpack config
  webpack: (config) => {
    config.externals.push(
      {
        "utf-8-validate": "commonjs utf-8-validate",
        bufferutil: "commonjs bufferutil",
      },
      "canvas",
      "jsdom"
    );
    return config;
  },

  // request logging
  logging: {
    // level: "verbose",
    fetches: {
      fullUrl: false,
    },
  },

  productionBrowserSourceMaps: true,
};

// local mdx config
const withMDX = nextMDX({
  extension: /\.mdx?$/,
  options: {
    remarkPlugins: [remarkGfm],
    rehypePlugins: [],
  },
});

// Bundle analyzer integration with ES modules
const withAnalytics = withStatoscope({
  enabled: true,
});

export default withMDX(withAnalytics(nextConfig));
pajecawav commented 1 week ago

Hi, do you have a large Next.js project you are trying to analyze? Does the problem disappear when you remove withStatoscope from your next config?

If you are sure that next-statoscope is causing your issue then you should probably report it directly to statoscope GitHub issues because next-statoscope really is just a wrapper around @statoscope/webpack-plugin

prof-awais commented 1 week ago

Does the problem disappear when you remove withStatoscope from your next config?

Yes it was removed. Okay I can put this question there.