webpack.tm-saguaro.config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. const path = require('path');
  2. const commonConfig = {
  3. mode: "production",
  4. module: {
  5. rules: [{
  6. test: /\.svg$/,
  7. issuer: /\.[jt]sx?$/,
  8. use: [{
  9. loader:'@svgr/webpack',
  10. options: {
  11. expandProps: "end",
  12. svgoConfig: {}
  13. }
  14. }]
  15. },{
  16. test: /\.(html|ico)$/,
  17. use: [{
  18. loader: 'file-loader',
  19. options: { name: '[name].[ext]' }
  20. }]
  21. },{
  22. test: /\.scss$/,
  23. use: [
  24. 'style-loader',
  25. {
  26. loader: 'css-loader',
  27. options: {
  28. modules: {
  29. localIdentName:'[local]'
  30. }
  31. }
  32. },
  33. 'sass-loader'
  34. ]
  35. }
  36. ]
  37. },
  38. resolve: {
  39. modules: [
  40. 'node_modules',
  41. path.resolve(__dirname, 'build/src/')
  42. ],
  43. fallback: {
  44. fs: false,
  45. buffer: require.resolve('buffer'),
  46. crypto: require.resolve('crypto-browserify'),
  47. path: require.resolve('path-browserify'),
  48. stream: require.resolve('stream-browserify')
  49. }
  50. }
  51. };
  52. const out_path = "build/TmFeatureViewer";
  53. const examples = [];
  54. examples.push({
  55. ...commonConfig,
  56. entry: {
  57. "tm-saguaro": './lib/TmFv3DApp/index.js'
  58. },
  59. output: {
  60. filename: '[name].js',
  61. path: path.resolve(__dirname, out_path),
  62. library: {
  63. name: 'tmSaguaro',
  64. type: 'umd'
  65. }
  66. }
  67. });
  68. module.exports = examples;