webpack.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. const path = require('path');
  2. const commonConfig = {
  3. module: {
  4. rules: [
  5. {
  6. test: /\.(html|ico)$/,
  7. use: [{
  8. loader: 'file-loader',
  9. options: { name: '[name].[ext]' }
  10. }]
  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 appConfig = {
  40. ...commonConfig,
  41. entry: {
  42. 'app':'./build/src/RcsbSaguaro3D.js'
  43. },
  44. mode: "production",
  45. output: {
  46. filename: '[name].js',
  47. library: 'RcsbFv3D',
  48. libraryTarget: 'umd',
  49. umdNamedDefine: true,
  50. path: path.resolve(__dirname, 'build/dist')
  51. }
  52. //, devtool: 'source-map'
  53. }
  54. module.exports = [appConfig];