webpack.examples.config.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. fallback: {
  35. fs: false,
  36. buffer: require.resolve('buffer'),
  37. crypto: require.resolve('crypto-browserify'),
  38. path: require.resolve('path-browserify'),
  39. stream: require.resolve('stream-browserify')
  40. }
  41. }
  42. };
  43. const out_path = "build/examples";
  44. const examples = [];
  45. examples.push({
  46. ...commonConfig,
  47. entry: {
  48. "index": './build/src/examples/uniprot/index.js'
  49. },
  50. output: {
  51. filename: '[name].js',
  52. path: path.resolve(__dirname, out_path+'/uniprot/')
  53. }
  54. });
  55. examples.push({
  56. ...commonConfig,
  57. entry: {
  58. "index": './build/src/examples/assembly/index.js'
  59. },
  60. output: {
  61. filename: '[name].js',
  62. path: path.resolve(__dirname, out_path+'/assembly/')
  63. }
  64. });
  65. examples.push({
  66. ...commonConfig,
  67. entry: {
  68. "index": './build/src/examples/external-mapping/index.js'
  69. },
  70. output: {
  71. filename: '[name].js',
  72. path: path.resolve(__dirname, out_path+'/external-mapping/')
  73. }
  74. });
  75. examples.push({
  76. ...commonConfig,
  77. entry: {
  78. "index": './build/src/examples/single-chain/index.js'
  79. },
  80. output: {
  81. filename: '[name].js',
  82. path: path.resolve(__dirname, out_path+'/single-chain/')
  83. }
  84. });
  85. examples.push({
  86. ...commonConfig,
  87. entry: {
  88. "index": './build/src/examples/structural-alignment/index.js'
  89. },
  90. output: {
  91. filename: '[name].js',
  92. path: path.resolve(__dirname, out_path+'/structural-alignment/')
  93. }
  94. });
  95. examples.push({
  96. ...commonConfig,
  97. entry: {
  98. "index": './build/src/examples/multiple-chain/index.js'
  99. },
  100. output: {
  101. filename: '[name].js',
  102. path: path.resolve(__dirname, out_path+'/multiple-chain/')
  103. }
  104. });
  105. examples.push({
  106. ...commonConfig,
  107. entry: {
  108. "index": './build/src/examples/css-config/index.js'
  109. },
  110. output: {
  111. filename: '[name].js',
  112. path: path.resolve(__dirname, out_path+'/css-config/')
  113. }
  114. });
  115. module.exports = examples;