2018-08-26 18:35:04 +03:00
|
|
|
const path = require('path')
|
|
|
|
const webpack = require('webpack')
|
2021-04-08 23:26:47 +03:00
|
|
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
2018-08-26 18:35:04 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'terminus-main',
|
2021-04-08 23:26:47 +03:00
|
|
|
target: 'electron-main',
|
2018-08-26 18:35:04 +03:00
|
|
|
entry: {
|
2018-08-31 16:41:28 +03:00
|
|
|
main: path.resolve(__dirname, 'lib/index.ts'),
|
2018-08-26 18:35:04 +03:00
|
|
|
},
|
2019-02-10 00:10:42 +03:00
|
|
|
mode: process.env.TERMINUS_DEV ? 'development' : 'production',
|
2018-08-26 18:35:04 +03:00
|
|
|
context: __dirname,
|
2019-06-24 14:40:37 +03:00
|
|
|
devtool: 'source-map',
|
2018-08-26 18:35:04 +03:00
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'dist'),
|
|
|
|
pathinfo: true,
|
|
|
|
filename: '[name].js',
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
modules: ['lib/', 'node_modules', '../node_modules'].map(x => path.join(__dirname, x)),
|
|
|
|
extensions: ['.ts', '.js'],
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2018-08-31 16:41:28 +03:00
|
|
|
test: /\.ts$/,
|
2018-08-26 18:35:04 +03:00
|
|
|
use: {
|
2018-08-31 16:41:28 +03:00
|
|
|
loader: 'awesome-typescript-loader',
|
2018-08-26 18:35:04 +03:00
|
|
|
options: {
|
2018-08-31 16:41:28 +03:00
|
|
|
configFileName: path.resolve(__dirname, 'tsconfig.main.json'),
|
2018-08-26 18:35:04 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
externals: {
|
2021-04-08 23:26:47 +03:00
|
|
|
'any-promise': 'commonjs any-promise',
|
2018-08-26 18:35:04 +03:00
|
|
|
electron: 'commonjs electron',
|
|
|
|
'electron-config': 'commonjs electron-config',
|
2021-04-08 23:26:47 +03:00
|
|
|
'electron-debug': 'commonjs electron-debug',
|
2021-01-01 20:25:54 +03:00
|
|
|
'electron-promise-ipc': 'commonjs electron-promise-ipc',
|
2018-08-26 18:35:04 +03:00
|
|
|
'electron-vibrancy': 'commonjs electron-vibrancy',
|
|
|
|
fs: 'commonjs fs',
|
2020-06-05 11:08:20 +03:00
|
|
|
glasstron: 'commonjs glasstron',
|
2018-08-26 18:35:04 +03:00
|
|
|
mz: 'commonjs mz',
|
2021-01-01 20:25:54 +03:00
|
|
|
npm: 'commonjs npm',
|
2021-04-16 21:15:39 +03:00
|
|
|
'@terminus-term/node-pty': 'commonjs @terminus-term/node-pty',
|
2018-08-26 18:35:04 +03:00
|
|
|
path: 'commonjs path',
|
2021-04-08 23:26:47 +03:00
|
|
|
rxjs: 'commonjs rxjs',
|
|
|
|
'rxjs/operators': 'commonjs rxjs/operators',
|
2021-01-01 20:25:54 +03:00
|
|
|
util: 'commonjs util',
|
|
|
|
'source-map-support': 'commonjs source-map-support',
|
2018-10-05 21:12:06 +03:00
|
|
|
'windows-swca': 'commonjs windows-swca',
|
2019-05-06 15:09:30 +03:00
|
|
|
'windows-blurbehind': 'commonjs windows-blurbehind',
|
2021-04-08 23:26:47 +03:00
|
|
|
'yargs/yargs': 'commonjs yargs/yargs',
|
2018-08-26 18:35:04 +03:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.optimize.ModuleConcatenationPlugin(),
|
2019-11-26 17:51:31 +03:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.type': '"main"',
|
|
|
|
}),
|
2018-08-26 18:35:04 +03:00
|
|
|
],
|
2021-04-08 23:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (process.env.BUNDLE_ANALYZER) {
|
|
|
|
module.exports.plugins.push(new BundleAnalyzerPlugin())
|
2018-08-26 18:35:04 +03:00
|
|
|
}
|