2025/03/13

Next.jsでMantineを使用した時の「Serializing big strings~」エラーの対処

Next.jsMantine

Next.jsでMantineを使用していた時、ターミナルに以下のようなエラーが表示されていました。

<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (118kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)

いろいろ調査したところ、以下で回答がありました。

https://stackoverflow.com/questions/78471919/how-to-debug-webpack-cache-packfilecachestrategy-serializing-big-strings-in

next.config.mjsに以下の記述を行うことで対処できるようです。

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
  // ...other configuration
  experimental: {
    optimizePackageImports: ['@mantine/core', '@mantine/hooks'],
  },
};

export default nextConfig;

最後に

株式会社Robbitsでは一緒に働く仲間を募集しています!
ご興味のある方は是非一度ホームページをご覧ください!

ホームページを見てみる