Meituan-Dianping/mpvue · error · Error

Server-side bundle should have one single entry file. Avoid

Error message

Server-side bundle should have one single entry file. Avoid using CommonsChunkPlugin in the server config.

What it means

Guard thrown by the SSR server webpack plugin during the emit hook when the compiled server bundle exposes more than one JS entry asset. The server renderer expects exactly one self-contained entry file; code splitting plugins like CommonsChunkPlugin split the server bundle in ways the renderer cannot load, so the configuration is rejected at build time.

Source

Thrown at src/server/webpack-plugin/server.js:26

  }

  apply (compiler) {
    validate(compiler)

    compiler.plugin('emit', (compilation, cb) => {
      const stats = compilation.getStats().toJson()
      const entryName = Object.keys(stats.entrypoints)[0]
      const entryInfo = stats.entrypoints[entryName]

      if (!entryInfo) {
        // #5553
        return cb()
      }

      const entryAssets = entryInfo.assets.filter(isJS)

      if (entryAssets.length > 1) {
        throw new Error(
          `Server-side bundle should have one single entry file. ` +
          `Avoid using CommonsChunkPlugin in the server config.`
        )
      }

      const entry = entryAssets[0]
      if (!entry || typeof entry !== 'string') {
        throw new Error(
          `Entry "${entryName}" not found. Did you specify the correct entry option?`
        )
      }

      const bundle = {
        entry,
        files: {},
        maps: {}
      }

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Remove CommonsChunkPlugin (or splitChunks) from the webpack server config
  2. Keep the server bundle as a single entry, targeting node with library Target: 'node'
  3. Move shared-chunk optimization to the client config only
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/server/webpack-plugin/server.js:26 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02). Data as JSON: /api/errors/a3d3984ad9c266f7. Report an issue: GitHub.