webpack.examples.config.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. const path = require('path');
  2. const commonConfig = {
  3. mode:"production",
  4. module: {
  5. rules: [
  6. {
  7. test: /\.(html|ico)$/,
  8. use: [{
  9. loader: 'file-loader',
  10. options: { name: '[name].[ext]' }
  11. }]
  12. },{
  13. test: /\.scss$/,
  14. use: [
  15. 'style-loader',
  16. {
  17. loader: 'css-loader',
  18. options: {
  19. modules: {
  20. localIdentName:'[local]'
  21. }
  22. }
  23. },
  24. 'sass-loader'
  25. ]
  26. }
  27. ]
  28. },
  29. resolve: {
  30. modules: [
  31. 'node_modules',
  32. path.resolve(__dirname, 'build/src/')
  33. ],
  34. },
  35. node: {
  36. fs: "empty"
  37. }
  38. };
  39. const out_path = "build/examples";
  40. const example_1 = {
  41. ...commonConfig,
  42. entry: {
  43. "index": './build/src/examples/single-chain/index.js'
  44. },
  45. output: {
  46. filename: '[name].js',
  47. path: path.resolve(__dirname, out_path+'/single-chain/')
  48. }
  49. }
  50. const example_2 = {
  51. ...commonConfig,
  52. entry: {
  53. "index": './build/src/examples/structural-alignment/index.js'
  54. },
  55. output: {
  56. filename: '[name].js',
  57. path: path.resolve(__dirname, out_path+'/structural-alignment/')
  58. }
  59. }
  60. const example_3 = {
  61. ...commonConfig,
  62. entry: {
  63. "index": './build/src/examples/assembly/index.js'
  64. },
  65. output: {
  66. filename: '[name].js',
  67. path: path.resolve(__dirname, out_path+'/assembly/')
  68. }
  69. }
  70. const example_4 = {
  71. ...commonConfig,
  72. entry: {
  73. "index": './build/src/examples/multiple-chain/index.js'
  74. },
  75. output: {
  76. filename: '[name].js',
  77. path: path.resolve(__dirname, out_path+'/multiple-chain/')
  78. }
  79. }
  80. const example_5 = {
  81. ...commonConfig,
  82. entry: {
  83. "index": './build/src/examples/css-config/index.js'
  84. },
  85. output: {
  86. filename: '[name].js',
  87. path: path.resolve(__dirname, out_path+'/css-config/')
  88. }
  89. }
  90. module.exports = [example_1, example_2, example_3, example_4, example_5];