webpack.main.config.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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: '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. fs: 'commonjs fs',
  39. mz: 'commonjs mz',
  40. path: 'commonjs path',
  41. yargs: 'commonjs yargs',
  42. 'windows-swca': 'commonjs windows-swca',
  43. 'windows-blurbehind': 'commonjs windows-blurbehind',
  44. },
  45. plugins: [
  46. new webpack.optimize.ModuleConcatenationPlugin(),
  47. new webpack.DefinePlugin({
  48. 'process.type': '"main"',
  49. }),
  50. ],
  51. }