1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-09 17:18:46 +03:00
tabby/app/webpack.config.main.mjs
Eugene 1e5cfd1d4b
bootstrap 5 WIP (#7891)
New standard theme that follows your chosen terminal colors, Bootstrap 5 & Angular 15 upgrade
2023-02-26 20:42:31 +01:00

72 lines
2.2 KiB
JavaScript

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))
const config = {
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: {
loader: 'ts-loader',
options: {
configFile: path.resolve(__dirname, 'tsconfig.main.json'),
},
},
},
],
},
externals: {
'v8-compile-cache': 'commonjs v8-compile-cache',
'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',
'node:os': 'commonjs os',
'@tabby-gang/node-pty': 'commonjs @tabby-gang/node-pty',
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',
'@tabby-gang/windows-blurbehind': 'commonjs @tabby-gang/windows-blurbehind',
'yargs/yargs': 'commonjs yargs/yargs',
},
plugins: [
new wp.optimize.ModuleConcatenationPlugin(),
new wp.DefinePlugin({
'process.type': '"main"',
}),
],
}
if (process.env.BUNDLE_ANALYZER) {
config.plugins.push(new BundleAnalyzerPlugin())
}
export default () => config