webpack.config.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const { IgnorePlugin } = require('webpack');
  2. const CopyWebpackPlugin = require('copy-webpack-plugin');
  3. const path = require('path');
  4. module.exports = {
  5. entry: './src/app.ts',
  6. module: {
  7. rules: [
  8. {
  9. test: /\.tsx?$/,
  10. use: 'ts-loader',
  11. exclude: /node_modules/,
  12. },
  13. ],
  14. },
  15. resolve: {
  16. extensions: ['.js', '.tsx', '.ts', ],
  17. alias: {
  18. "@src": path.resolve(__dirname, "src"),
  19. "@root": path.resolve(__dirname, "../"),
  20. "@classes": path.resolve(__dirname, "../base-lib/src/classes/"),
  21. "@core": path.resolve(__dirname, "../base-lib/src/core/"),
  22. "@util": path.resolve(__dirname, "../base-lib/src/util/"),
  23. "@core-models": path.resolve(__dirname, "../base-lib/src/core-models/"),
  24. "@core-guards": path.resolve(__dirname, "../base-lib/src/core-guards/")
  25. }
  26. },
  27. target: 'node',
  28. externals:{
  29. "fs": "commonjs fs",
  30. "net": "commonjs net",
  31. "pg": "commonjs pg"
  32. },
  33. plugins: [
  34. new IgnorePlugin({
  35. resourceRegExp: /^pg-native$/,
  36. }),
  37. new CopyWebpackPlugin({
  38. patterns: [
  39. {from: 'config.json'},
  40. {from: 'proxy.json'},
  41. ]
  42. })
  43. ],
  44. output: {
  45. filename: 'index.js',
  46. path: path.resolve(__dirname, '../__dist/pmr-api-gateway'),
  47. },
  48. optimization: {
  49. minimize: false
  50. }
  51. };