#2331·pino

Can not find module 'pino-std-serializers' on Electron windows app

Author: roddcCreated Oct 27, 2025Updated Jun 29, 2026

I'm trying to integrate pino in my Electron app, I made the pino as externals in rspack, but I can't install the app because of Can not find module 'pino-std-serializers'. How do I fix this? This my bundler config, I wrote a custom plugin to load pino module

const pinoWorkerPlugin = (): RsbuildPlugin => ({
  name: 'pino-worker-plugin',
  setup(api) {
    // Add the path override for pino worker
    api.onBeforeBuild(() => {
      const pinoWorkerPath = getPinoWorkerPath();
      if (pinoWorkerPath) {
        (
          globalThis as { __bundlerPathsOverrides?: Record<string, string> }
        ).__bundlerPathsOverrides = {
          'pino-worker': pinoWorkerPath,
        };
      }
    });

    api.modifyRspackConfig((config) => {
      return {
        ...config,
        externals: [
          ...(Array.isArray(config.externals) ? config.externals : []),
          {
            pino: 'pino',
            'pino-pretty': 'pino-pretty',
            'pino-roll': 'pino-roll',
            'pino-std-serializers': 'pino-std-serializers',
          },
        ],
        experiments: {
          ...config.experiments,
          outputModule: true,
        },
      };
    });
  },
});