webpack.config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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, 'lib/')
  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 appConfig = {
  44. ...commonConfig,
  45. entry: {
  46. 'app':'./lib/app.js'
  47. },
  48. mode: "production",
  49. output: {
  50. filename: '[name].js',
  51. library: 'RcsbFv3D',
  52. libraryTarget: 'umd',
  53. umdNamedDefine: true,
  54. path: path.resolve(__dirname, 'build/dist')
  55. }
  56. //, devtool: 'source-map'
  57. }
  58. module.exports = [appConfig];