webpack.server.conf.js 957 Bytes
const merge = require('webpack-merge');
const path = require('path');
const config = require('../config/common');
const baseWebpackConfig = require('./webpack.base.conf');

const serverWebpackConfig = merge(baseWebpackConfig, {
  mode: 'development',
  target: 'node',
  entry: {
    app: path.join(__dirname, '../apps/entry-server.js')
  },
  output: {
    path: path.join(__dirname, '../' + config.build.outputPath),
    filename: 'server-entry.js',
    chunkFilename: 'js/[id].[chunkhash].js',
    publicPath: '/assets/',
    libraryTarget: 'commonjs2'
  },
  module: {
    rules: [{
        test: /\.s?css$/,
        use: 'ignore-loader'
    }]
  },
  // 去除依赖,不打包到生成的文件中
  // 打包出来的代码是运行在node环境中的,这些类库是可以通过require()方式调用的
  externals: Object.keys(require('../package.json').dependencies),
//   devtool: config.dev.devtool,
});

module.exports = serverWebpackConfig;