webpack.server.config.js 635 B

123456789101112131415161718192021222324252627282930313233
  1. var fs = require('fs')
  2. var path = require('path')
  3. module.exports = {
  4. entry: path.resolve(__dirname, 'server.js'),
  5. output: {
  6. filename: 'server.bundle.js'
  7. },
  8. target: 'node',
  9. // keep node_module paths out of the bundle
  10. externals: fs.readdirSync(path.resolve(__dirname, 'node_modules')).concat([
  11. 'react-dom/server'
  12. ]).reduce(function (ext, mod) {
  13. ext[mod] = 'commonjs ' + mod
  14. return ext
  15. }, {}),
  16. node: {
  17. __filename: false,
  18. __dirname: false
  19. },
  20. module: {
  21. loaders: [
  22. { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?presets[]=es2015&presets[]=react' }
  23. ]
  24. }
  25. }