No Description

webpack.production.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. var merge = require('webpack-merge')
  2. , ExtractTextPlugin = require('extract-text-webpack-plugin')
  3. , OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
  4. , path = require('path')
  5. , baseConfigs = require('./webpack.base')
  6. module.exports = merge(baseConfigs, {
  7. mode: 'production',
  8. devtool: 'source-map',
  9. context: path.join(__dirname, '../src'),
  10. entry: {
  11. index: './index.jsx'
  12. },
  13. output: {
  14. path: path.join(__dirname, '../dist'),
  15. filename: 'index.js',
  16. publicPath: '/',
  17. libraryTarget: 'umd'
  18. },
  19. externals: {
  20. 'react': 'react',
  21. 'react-dom': 'react-dom',
  22. 'draft-js': 'draft-js',
  23. 'draft-convert': 'draft-convert',
  24. 'draftjs-utils': 'draftjs-utils',
  25. 'braft-finder': 'braft-finder',
  26. 'braft-utils': 'braft-utils',
  27. 'braft-convert': 'braft-convert',
  28. 'immutable': 'immutable'
  29. },
  30. optimization: {
  31. minimize: false,
  32. },
  33. plugins: [
  34. new ExtractTextPlugin('index.css'),
  35. new OptimizeCssAssetsPlugin({
  36. assetNameRegExp: /.css$/,
  37. cssProcessor: require('cssnano'),
  38. sourceMap: true,
  39. cssProcessorOptions: {
  40. discardComments: {
  41. removeAll: true
  42. },
  43. zindex: false,
  44. safe: true
  45. }
  46. }),
  47. ]
  48. })