insomnia/packages/insomnia-inso/esbuild.ts
Filipe Freire 9800ad5aee
chore: use npm workspaces (herecles) (#6193)
* chore: use npm workspaces

* edit workspaces

* fix

* fix

* force workspace order

* fix lock?

* define max_old_space_size on CI

* rm unnecessary bootstrap

* fix

* cleanup package.json

* bump vite and re-add build to bootstrap

* define paths on tsconfig

* fix some things

* add mocha to vite config

* bump mocha

* remove tsconfigs and project refs

* cache npm install

* fixed types

* assing repo root

* merge lint configs

* fix clean

* fix tests

* setup node

* lockfile

* fix bump

* fix lint markdown

* temporary disable inso tests

* dont use rimraf

* simplify clean

* fix version

* lockfile

* inso build

* fix lint

* lock file

* remove cleans

* remove unused

* tslib hack

* redownload node-libcurl

* rm version from scripts

* fix extrainfo bug

* use npm version

---------

Co-authored-by: jackkav <jackkav@gmail.com>
2023-08-10 00:14:16 +02:00

30 lines
879 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);
const version = process.env.VERSION || 'dev';
build({
outfile: './dist/index.js',
bundle: true,
platform: 'node',
minify: isProd,
target: 'node18',
sourcemap: true,
format: 'cjs',
tsconfig: 'tsconfig.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 ? version : 'dev'),
'__DEV__': JSON.stringify(!isProd),
},
external: ['@getinsomnia/node-libcurl', 'mocha'],
entryPoints: ['./src/index.ts'],
});