How to use the vue-server-renderer/server-plugin function in vue-server-renderer

To help you get started, we’ve selected a few vue-server-renderer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nuxt / nuxt.js / lib / builder / webpack / server.config.js View on Github external
config = Object.assign(config, {
    target: 'node',
    node: false,
    devtool: this.options.dev ? config.devtool : 'source-map',
    entry: resolve(this.options.buildDir, 'server.js'),
    output: Object.assign({}, config.output, {
      filename: 'server-bundle.js',
      libraryTarget: 'commonjs2'
    }),
    performance: {
      hints: false,
      maxAssetSize: Infinity
    },
    externals: [],
    plugins: (config.plugins || []).concat([
      new VueSSRServerPlugin({
        filename: 'server-bundle.json'
      }),
      new webpack.DefinePlugin(Object.assign(env, {
        'process.env.NODE_ENV': JSON.stringify(env.NODE_ENV || (this.options.dev ? 'development' : 'production')),
        'process.env.VUE_ENV': JSON.stringify('server'),
        'process.mode': JSON.stringify(this.options.mode),
        'process.browser': false,
        'process.client': false,
        'process.server': true,
        'process.static': this.isStatic
      }))
    ])
  })

  // https://webpack.js.org/configuration/externals/#externals
  // https://github.com/liady/webpack-node-externals