webpack.config.min.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Created by Jacky.Gao on 2018-04-15.
  3. * Base on Webpack4
  4. */
  5. const path=require('path');
  6. module.exports={
  7. mode:'production',
  8. entry: {
  9. designer:'./src/index.js',
  10. searchform:'./src/form/index.js',
  11. preview:'./src/preview.js'
  12. },
  13. output:{
  14. path:path.resolve('../ureport2-console/src/main/resources/ureport-asserts/js'),
  15. filename:'[name].bundle.js'
  16. },
  17. optimization: {
  18. splitChunks: {
  19. cacheGroups: {
  20. vendor: {
  21. // 抽离第三方插件
  22. test: /handsontable|codemirror|chart.js/,
  23. chunks: 'initial',
  24. name: 'common',
  25. priority: 10
  26. }
  27. }
  28. }
  29. },
  30. module:{
  31. rules:[
  32. {
  33. test: /\.js$/,
  34. exclude: /node_modules/,
  35. loader: "babel-loader"
  36. },
  37. {
  38. test:/\.css$/,
  39. use: [{ loader: 'style-loader' }, { loader: 'css-loader' }]
  40. },
  41. {
  42. test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
  43. use: [
  44. {
  45. loader: 'url-loader',
  46. options: {
  47. limit: 10000000
  48. }
  49. }
  50. ]
  51. }
  52. ]
  53. }
  54. };