webpack.config.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. const path = require('path')
  2. const webpack = require('webpack')
  3. module.exports = {
  4. target: 'node',
  5. entry: 'src/index.ts',
  6. devtool: 'source-map',
  7. context: __dirname,
  8. output: {
  9. path: path.resolve(__dirname, 'dist'),
  10. filename: 'index.js',
  11. pathinfo: true,
  12. libraryTarget: 'umd',
  13. devtoolModuleFilenameTemplate: 'webpack-terminus-terminal:///[resource-path]',
  14. },
  15. mode: process.env.TERMINUS_DEV ? 'development' : 'production',
  16. optimization: {
  17. minimize: false,
  18. },
  19. resolve: {
  20. modules: ['.', 'src', 'node_modules', '../app/node_modules'].map(x => path.join(__dirname, x)),
  21. extensions: ['.ts', '.js'],
  22. },
  23. module: {
  24. rules: [
  25. {
  26. test: /\.ts$/,
  27. use: {
  28. loader: 'awesome-typescript-loader',
  29. query: {
  30. configFileName: path.resolve(__dirname, 'tsconfig.json'),
  31. typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
  32. paths: {
  33. "terminus-*": [path.resolve(__dirname, '../terminus-*')],
  34. "*": [path.resolve(__dirname, '../app/node_modules/*')],
  35. }
  36. },
  37. },
  38. },
  39. { test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
  40. { test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
  41. { test: /\.css$/, use: ['style-loader', 'css-loader'] },
  42. { test: /\.svg/, use: ['svg-inline-loader'] },
  43. {
  44. test: /\.(ttf|eot|otf|woff|woff2|ogg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  45. use: {
  46. loader: 'url-loader',
  47. options: {
  48. limit: 999999999999,
  49. }
  50. }
  51. },
  52. ]
  53. },
  54. externals: [
  55. 'electron',
  56. 'fs',
  57. 'font-manager',
  58. 'path',
  59. 'macos-native-processlist',
  60. 'windows-process-tree',
  61. 'mz/fs',
  62. 'mz/child_process',
  63. 'node-pty',
  64. /^rxjs/,
  65. /^@angular/,
  66. /^@ng-bootstrap/,
  67. 'ngx-toastr',
  68. /^terminus-/,
  69. ],
  70. plugins: [
  71. new webpack.optimize.ModuleConcatenationPlugin(),
  72. ],
  73. }