webpack.common.config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. const path = require('path');
  2. const HtmlWebpackPlugin = require('html-webpack-plugin')
  3. module.exports = {
  4. //devtool: 'cheap-module-eval-source-map',
  5. entry: {
  6. contact: './src/contact/index.js',
  7. framework: ['react','react-dom','redux','react-redux'],
  8. staff:'./src/staff/index.js',
  9. workbench:'./src/workbench/index.js',
  10. hr:'./src/human-resource/index.js',
  11. product:'./src/product/index.js',
  12. login:'./src/login/index.js',
  13. },
  14. // output: {
  15. // filename: 'js/bundle.js',
  16. // path: path.resolve(__dirname, '../dist')
  17. // },
  18. module: {
  19. rules: [
  20. {
  21. test: /\.(js|jsx)$/,
  22. use: 'babel-loader',
  23. exclude: /node_modules/,
  24. },
  25. {
  26. test: /\.(jpg|png|gif)$/,
  27. use: {
  28. loader: 'url-loader',
  29. options: {
  30. name: '[name].[ext]',
  31. outputPath: 'images/',
  32. limit: 8192,
  33. },
  34. }
  35. },
  36. // {
  37. // test: /\.css$/,
  38. // use: [
  39. // {
  40. // loader:'style-loader',
  41. // options:{
  42. // insert:'top'
  43. // }
  44. // },
  45. // 'css-loader'],
  46. // },
  47. // {
  48. // test: /\.(eot|woff)$/, loader: "file-loader"
  49. // }
  50. ]
  51. },
  52. plugins: [
  53. new HtmlWebpackPlugin({
  54. template: 'public/sub_index.html',
  55. filename: 'contact/index.html',
  56. chunks:['contact','framework']
  57. }),
  58. new HtmlWebpackPlugin({
  59. template: 'public/sub_index.html',
  60. filename: 'staff/index.html',
  61. chunks:['staff','framework']
  62. }),
  63. new HtmlWebpackPlugin({
  64. template: 'public/sub_index.html',
  65. filename: 'hr/index.html',
  66. chunks:['hr','framework']
  67. }),
  68. new HtmlWebpackPlugin({
  69. template: 'public/sub_index.html',
  70. filename: 'product/index.html',
  71. chunks:['product','framework']
  72. }),
  73. new HtmlWebpackPlugin({
  74. template: 'public/index.html',
  75. filename: 'login.html',
  76. chunks:['login','framework']
  77. }),
  78. ]
  79. }