webpack.config.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. const path = require('path')
  2. const webpack = require('webpack')
  3. module.exports = {
  4. name: 'terminus',
  5. target: 'node',
  6. entry: {
  7. 'index.ignore': 'file-loader?name=index.html!val-loader!pug-html-loader!' + path.resolve(__dirname, './index.pug'),
  8. 'preload': path.resolve(__dirname, 'src/entry.preload.ts'),
  9. 'bundle': path.resolve(__dirname, 'src/entry.ts'),
  10. },
  11. context: __dirname,
  12. devtool: 'source-map',
  13. output: {
  14. path: path.join(__dirname, 'dist'),
  15. pathinfo: true,
  16. filename: '[name].js'
  17. },
  18. resolve: {
  19. modules: ['src/', 'node_modules', '../node_modules', 'assets/'].map(x => path.join(__dirname, x)),
  20. extensions: ['.ts', '.js'],
  21. },
  22. module: {
  23. rules: [
  24. {
  25. test: /\.ts$/,
  26. use: {
  27. loader: 'awesome-typescript-loader',
  28. options: {
  29. configFileName: path.resolve(__dirname, 'tsconfig.json'),
  30. }
  31. }
  32. },
  33. { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
  34. { test: /\.css$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
  35. {
  36. test: /\.(png|svg)$/,
  37. use: {
  38. loader: 'file-loader',
  39. options: {
  40. name: 'images/[name].[ext]'
  41. }
  42. }
  43. },
  44. {
  45. test: /\.(ttf|eot|otf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  46. use: {
  47. loader: 'file-loader',
  48. options: {
  49. name: 'fonts/[name].[ext]'
  50. }
  51. }
  52. }
  53. ]
  54. },
  55. externals: {
  56. '@angular/core': 'commonjs @angular/core',
  57. '@angular/compiler': 'commonjs @angular/compiler',
  58. '@angular/platform-browser': 'commonjs @angular/platform-browser',
  59. '@angular/platform-browser-dynamic': 'commonjs @angular/platform-browser-dynamic',
  60. '@angular/forms': 'commonjs @angular/forms',
  61. '@angular/common': 'commonjs @angular/common',
  62. '@ng-bootstrap/ng-bootstrap': 'commonjs @ng-bootstrap/ng-bootstrap',
  63. 'child_process': 'commonjs child_process',
  64. 'electron': 'commonjs electron',
  65. 'electron-is-dev': 'commonjs electron-is-dev',
  66. 'ngx-toastr': 'commonjs ngx-toastr',
  67. 'module': 'commonjs module',
  68. 'mz': 'commonjs mz',
  69. 'path': 'commonjs path',
  70. 'rxjs': 'commonjs rxjs',
  71. 'zone.js': 'commonjs zone.js/dist/zone.js',
  72. },
  73. plugins: [
  74. new webpack.optimize.ModuleConcatenationPlugin(),
  75. ],
  76. }