UNPKG

@comet-cli/plugin-documentation

Version:
44 lines (37 loc) 1.57 kB
const merge = require('webpack-merge'); const nodeExternals = require('webpack-node-externals'); const baseConfig = require('./webpack.base.config.js'); const VueSSRServerPlugin = require('vue-server-renderer/server-plugin'); const path = require('path'); module.exports = merge(baseConfig, { mode: 'production', // Point entry to your app's server entry file entry: path.resolve(__dirname, '../src/entry-server.ts'), // This allows webpack to handle dynamic imports in a Node-appropriate // fashion, and also tells `vue-loader` to emit server-oriented code when // compiling Vue components. target: 'node', // For bundle renderer source map support devtool: 'source-map', // This tells the server bundle to use Node-style exports output: { filename: 'server-bundle.js', libraryTarget: 'commonjs2' }, // https://webpack.js.org/configuration/externals/#function // https://github.com/liady/webpack-node-externals // Externalize app dependencies. This makes the server build much faster // and generates a smaller bundle file. externals: nodeExternals({ // do not externalize dependencies that need to be processed by webpack. // you can add more file types here e.g. raw *.vue files // you should also whitelist deps that modifies `global` (e.g. polyfills) whitelist: [/\.css$/, /\.vue$/] }), // This is the plugin that turns the entire output of the server build // into a single JSON file. The default file name will be // `vue-ssr-server-bundle.json` plugins: [ new VueSSRServerPlugin() ] });