2025/03/13
Next.jsでMantineを使用した時の「Serializing big strings~」エラーの対処
Next.jsでMantineを使用していた時、ターミナルに以下のようなエラーが表示されていました。
<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (118kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)
いろいろ調査したところ、以下で回答がありました。
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;