2023-02-26 19:42:31 +00:00
|
|
|
import * as path from 'path'
|
|
|
|
import wp from 'webpack'
|
|
|
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
|
|
|
import * as url from 'url'
|
|
|
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
2018-08-26 15:35:04 +00:00
|
|
|
|
2023-02-26 19:42:31 +00:00
|
|
|
const config = {
|
2021-06-30 16:32:18 +00:00
|
|
|
name: 'tabby-main',
|
|
|
|
target: 'electron-main',
|
|
|
|
entry: {
|
|
|
|
main: path.resolve(__dirname, 'lib/index.ts'),
|
|
|
|
},
|
|
|
|
mode: process.env.TABBY_DEV ? 'development' : 'production',
|
|
|
|
context: __dirname,
|
|
|
|
devtool: 'source-map',
|
|
|
|
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: [
|
|
|
|
{
|
|
|
|
test: /\.ts$/,
|
|
|
|
use: {
|
2021-07-06 07:40:54 +00:00
|
|
|
loader: 'ts-loader',
|
2021-06-30 16:32:18 +00:00
|
|
|
options: {
|
2021-07-06 07:40:54 +00:00
|
|
|
configFile: path.resolve(__dirname, 'tsconfig.main.json'),
|
2021-06-30 16:32:18 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
externals: {
|
2021-07-27 07:59:35 +00:00
|
|
|
'v8-compile-cache': 'commonjs v8-compile-cache',
|
2021-06-30 16:32:18 +00:00
|
|
|
'any-promise': 'commonjs any-promise',
|
|
|
|
electron: 'commonjs electron',
|
|
|
|
'electron-config': 'commonjs electron-config',
|
|
|
|
'electron-debug': 'commonjs electron-debug',
|
|
|
|
'electron-promise-ipc': 'commonjs electron-promise-ipc',
|
|
|
|
fs: 'commonjs fs',
|
|
|
|
glasstron: 'commonjs glasstron',
|
|
|
|
mz: 'commonjs mz',
|
|
|
|
npm: 'commonjs npm',
|
2021-08-15 22:02:24 +00:00
|
|
|
'node:os': 'commonjs os',
|
2023-06-26 14:28:43 +00:00
|
|
|
'node-pty': 'commonjs node-pty',
|
2021-06-30 16:32:18 +00:00
|
|
|
path: 'commonjs path',
|
|
|
|
util: 'commonjs util',
|
|
|
|
'source-map-support': 'commonjs source-map-support',
|
|
|
|
'windows-swca': 'commonjs windows-swca',
|
|
|
|
'windows-native-registry': 'commonjs windows-native-registry',
|
2021-12-12 12:14:24 +00:00
|
|
|
'@tabby-gang/windows-blurbehind': 'commonjs @tabby-gang/windows-blurbehind',
|
2021-06-30 16:32:18 +00:00
|
|
|
'yargs/yargs': 'commonjs yargs/yargs',
|
|
|
|
},
|
|
|
|
plugins: [
|
2023-02-26 19:42:31 +00:00
|
|
|
new wp.optimize.ModuleConcatenationPlugin(),
|
|
|
|
new wp.DefinePlugin({
|
2021-06-30 16:32:18 +00:00
|
|
|
'process.type': '"main"',
|
|
|
|
}),
|
2018-08-26 15:35:04 +00:00
|
|
|
],
|
2021-04-08 20:26:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (process.env.BUNDLE_ANALYZER) {
|
2023-02-26 19:42:31 +00:00
|
|
|
config.plugins.push(new BundleAnalyzerPlugin())
|
2018-08-26 15:35:04 +00:00
|
|
|
}
|
2023-02-26 19:42:31 +00:00
|
|
|
|
|
|
|
export default () => config
|