webpack.main.config.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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-promise-ipc': 'commonjs electron-promise-ipc',
  38. 'electron-vibrancy': 'commonjs electron-vibrancy',
  39. fs: 'commonjs fs',
  40. glasstron: 'commonjs glasstron',
  41. mz: 'commonjs mz',
  42. npm: 'commonjs npm',
  43. 'node-pty': 'commonjs node-pty',
  44. path: 'commonjs path',
  45. util: 'commonjs util',
  46. 'source-map-support': 'commonjs source-map-support',
  47. 'windows-swca': 'commonjs windows-swca',
  48. 'windows-blurbehind': 'commonjs windows-blurbehind',
  49. },
  50. plugins: [
  51. new webpack.optimize.ModuleConcatenationPlugin(),
  52. new webpack.DefinePlugin({
  53. 'process.type': '"main"',
  54. }),
  55. ],
  56. // Ignore warnings due to yarg's dynamic module loading
  57. ignoreWarnings: [/node_modules\/yargs/],
  58. }