webpack.common.config.js 1.4 KB

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