webpack.common.config.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. },
  12. output: {
  13. filename: 'js/bundle.js',
  14. path: path.resolve(__dirname, '../dist')
  15. },
  16. module: {
  17. rules: [
  18. {
  19. test: /\.(js|jsx)$/,
  20. use: 'babel-loader',
  21. exclude: /node_modules/,
  22. },
  23. {
  24. test: /\.(jpg|png|gif)$/,
  25. use: {
  26. loader: 'url-loader',
  27. options: {
  28. name: '[name].[ext]',
  29. outputPath: 'images/',
  30. limit: 8192,
  31. },
  32. }
  33. }
  34. // {
  35. // test: /\.css$/,
  36. // use: [
  37. // {
  38. // loader:'style-loader',
  39. // options:{
  40. // insert:'top'
  41. // }
  42. // },
  43. // 'css-loader'],
  44. // },
  45. // {
  46. // test: /\.(eot|woff)$/, loader: "file-loader"
  47. // }
  48. ]
  49. },
  50. plugins: [
  51. new HtmlWebpackPlugin({
  52. template: 'public/sub_index.html',
  53. filename: 'contact/index.html',
  54. chunks:['contact','framework']
  55. }),
  56. new HtmlWebpackPlugin({
  57. template: 'public/sub_index.html',
  58. filename: 'staff/index.html',
  59. chunks:['staff','framework']
  60. }),
  61. new HtmlWebpackPlugin({
  62. template: 'public/sub_index.html',
  63. filename: 'hr/index.html',
  64. chunks:['hr','framework']
  65. }),
  66. ]
  67. }