Meituan-Dianping/mpvue · error
webpack config `target` should be "node".
Error message
webpack config `target` should be "node".
What it means
Emitted by the validate() check of the Vue SSR webpack plugin: it inspects the user's webpack compiler options and warns when compiler.options.target !== 'node'. The plugin's whole design (server bundle, manifest and externalized dependencies) assumes a Node-targeted server build; targeting 'web' produces a browser bundle that the server renderer cannot load, so this is a configuration sanity warning printed via chalk in red before the build proceeds.
Source
Thrown at src/server/webpack-plugin/util.js:9
const { red, yellow } = require('chalk')
const prefix = `[vue-server-renderer-webpack-plugin]`
const warn = exports.warn = msg => console.error(red(`${prefix} ${msg}\n`))
const tip = exports.tip = msg => console.log(yellow(`${prefix} ${msg}\n`))
export const validate = compiler => {
if (compiler.options.target !== 'node') {
warn('webpack config `target` should be "node".')
}
if (compiler.options.output && compiler.options.output.libraryTarget !== 'commonjs2') {
warn('webpack config `output.libraryTarget` should be "commonjs2".')
}
if (!compiler.options.externals) {
tip(
'It is recommended to externalize dependencies in the server build for ' +
'better build performance.'
)
}
}
export { isJS, isCSS } from '../util'
View on GitHub (pinned to 6c5d78ee04)
Solutions
- Set target: 'node' in the webpack config used for the server bundle
- Keep separate webpack configs for client (target: 'web') and server (target: 'node') entries
- Point the VueSSRServerPlugin at the server config only, and verify the config object actually passed to webpack
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/server/webpack-plugin/util.js:9 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/bd8d0987bc74ffbf.
Report an issue: GitHub.