other.webpack.config.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const webpack = require('webpack');
  2. const CleanWebpackPlugin = require('clean-webpack-plugin');
  3. const config = require('../config');
  4. const paths = config.utils_paths;
  5. const vendors = [
  6. 'fastclick',
  7. 'promise',
  8. 'react-redux',
  9. 'redux',
  10. 'redux-thunk',
  11. 'superagent',
  12. 'react',
  13. 'react-dom',
  14. 'react-router-dom',
  15. 'history',
  16. ];
  17. module.exports = {
  18. output: {
  19. filename: '[name]_[hash].js',
  20. path: paths.lib(),
  21. library: '[name]_[hash]',
  22. },
  23. resolve: {
  24. extensions: ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', '.ts', '.tsx', '.js', '.jsx', '.json'],
  25. },
  26. entry: {
  27. lib: vendors,
  28. },
  29. plugins: [
  30. new webpack.DefinePlugin(config.globals),
  31. new CleanWebpackPlugin(['*'], {
  32. root: paths.lib(),
  33. }),
  34. new webpack.ProgressPlugin(),
  35. new webpack.optimize.UglifyJsPlugin({
  36. compress: {
  37. warnings: false,
  38. },
  39. }),
  40. new webpack.DllPlugin({
  41. path: paths.lib('manifest.json'),
  42. name: '[name]_[hash]',
  43. context: paths.lib(),
  44. }),
  45. ],
  46. };