webpack.common.config.js 1.8 KB

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