webpack.main.config.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const path = require('path')
  2. const webpack = require('webpack')
  3. module.exports = {
  4. name: 'terminus-main',
  5. target: 'node',
  6. entry: {
  7. main: path.resolve(__dirname, 'lib/index.ts'),
  8. },
  9. mode: process.env.TERMINUS_DEV ? 'development' : 'production',
  10. context: __dirname,
  11. devtool: 'eval-source-map',
  12. output: {
  13. path: path.join(__dirname, 'dist'),
  14. pathinfo: true,
  15. filename: '[name].js',
  16. },
  17. resolve: {
  18. modules: ['lib/', 'node_modules', '../node_modules'].map(x => path.join(__dirname, x)),
  19. extensions: ['.ts', '.js'],
  20. },
  21. module: {
  22. rules: [
  23. {
  24. test: /\.ts$/,
  25. use: {
  26. loader: 'awesome-typescript-loader',
  27. options: {
  28. configFileName: path.resolve(__dirname, 'tsconfig.main.json'),
  29. },
  30. },
  31. },
  32. ],
  33. },
  34. externals: {
  35. electron: 'commonjs electron',
  36. 'electron-config': 'commonjs electron-config',
  37. 'electron-vibrancy': 'commonjs electron-vibrancy',
  38. 'electron-squirrel-startup': 'commonjs electron-squirrel-startup',
  39. fs: 'commonjs fs',
  40. mz: 'commonjs mz',
  41. path: 'commonjs path',
  42. yargs: 'commonjs yargs',
  43. 'windows-swca': 'commonjs windows-swca',
  44. '@terminus-term/windows-blurbehind': 'commonjs @terminus-term/windows-blurbehind',
  45. },
  46. plugins: [
  47. new webpack.optimize.ModuleConcatenationPlugin(),
  48. ],
  49. }