webpack.dll.js 924 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @author oldj
  3. * @blog https://oldj.net
  4. */
  5. 'use strict'
  6. const path = require('path')
  7. const webpack = require('webpack')
  8. const moment = require('moment')
  9. const basedir = path.dirname(__dirname)
  10. const vendors = [
  11. 'react', 'react-dom', 'antd', 'lodash',
  12. 'moment', 'classnames', 'codemirror'
  13. ]
  14. module.exports = {
  15. entry: {
  16. 'lib': vendors
  17. },
  18. output: {
  19. path: path.join(basedir, 'app', 'ui'),
  20. filename: '[name].js',
  21. library: '[name]'
  22. },
  23. plugins: [
  24. new webpack.optimize.UglifyJsPlugin({
  25. sourceMap: true,
  26. compress: {
  27. warnings: false,
  28. screw_ie8: true,
  29. drop_console: true,
  30. drop_debugger: true
  31. }
  32. }),
  33. new webpack.DllPlugin({
  34. path: path.join(basedir, 'tmp', 'manifest.json'),
  35. name: '[name]',
  36. context: basedir
  37. }),
  38. new webpack.BannerPlugin(`SwitchHosts! lib.js, ${moment().format('YYYY-MM-DD HH:mm:ss')}`)
  39. ]
  40. }