mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
ffbf2ee42f
* electron 23 bump * lock files * fix type
29 lines
851 B
TypeScript
29 lines
851 B
TypeScript
import { build } from 'esbuild';
|
|
import { nodeExternalsPlugin } from 'esbuild-node-externals';
|
|
|
|
const isProd = Boolean(process.env.NODE_ENV === 'production');
|
|
const watch = Boolean(process.env.ESBUILD_WATCH);
|
|
|
|
build({
|
|
outfile: './dist/index.js',
|
|
bundle: true,
|
|
platform: 'node',
|
|
minify: isProd,
|
|
target: 'node18',
|
|
sourcemap: true,
|
|
format: 'cjs',
|
|
tsconfig: 'tsconfig.build.json',
|
|
watch,
|
|
plugins: [
|
|
// Exclude node_modules from the bundle since they will be packaged with the cli
|
|
nodeExternalsPlugin(),
|
|
],
|
|
define: {
|
|
'process.env.DEFAULT_APP_NAME': JSON.stringify(isProd ? 'Insomnia' : 'insomnia-app'),
|
|
'process.env.VERSION': JSON.stringify(isProd ? process.env.VERSION : 'dev'),
|
|
'__DEV__': JSON.stringify(!isProd),
|
|
},
|
|
external: ['@getinsomnia/node-libcurl', 'mocha'],
|
|
entryPoints: ['./src/index.ts'],
|
|
});
|