webpack.config.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.DEV ? 'development' : 'production',
  16. resolve: {
  17. modules: ['.', 'src', 'node_modules', '../app/node_modules'].map(x => path.join(__dirname, x)),
  18. extensions: ['.ts', '.js'],
  19. },
  20. module: {
  21. rules: [
  22. {
  23. test: /\.ts$/,
  24. use: {
  25. loader: 'awesome-typescript-loader',
  26. query: {
  27. configFileName: path.resolve(__dirname, 'tsconfig.json'),
  28. typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
  29. paths: {
  30. "terminus-*": [path.resolve(__dirname, '../terminus-*')],
  31. "*": [path.resolve(__dirname, '../app/node_modules/*')],
  32. }
  33. },
  34. },
  35. },
  36. { test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
  37. { test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
  38. { test: /\.css$/, use: ['style-loader', 'css-loader'] },
  39. { test: /\.svg/, use: ['svg-inline-loader'] },
  40. {
  41. test: /\.(ttf|eot|otf|woff|woff2|ogg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  42. use: {
  43. loader: 'url-loader',
  44. options: {
  45. limit: 999999999999,
  46. }
  47. }
  48. },
  49. ]
  50. },
  51. externals: [
  52. 'electron',
  53. 'fs',
  54. 'font-manager',
  55. 'path',
  56. 'node-pty-tmp',
  57. 'mz/fs',
  58. 'mz/child_process',
  59. 'winreg',
  60. /^rxjs/,
  61. /^@angular/,
  62. /^@ng-bootstrap/,
  63. 'ngx-toastr',
  64. /^terminus-/,
  65. ],
  66. plugins: [
  67. new webpack.optimize.ModuleConcatenationPlugin(),
  68. ],
  69. }