MCPcopy
hub / github.com/Kong/insomnia / build

Function build

packages/insomnia/esbuild.entrypoints.ts:24–258  ·  view source on GitHub ↗
(options: Options)

Source from the content-addressed store, hash-verified

22const inspectPort = process.env.INSPECT_PORT || '5858';
23
24export default async function build(options: Options) {
25 const mode = options.mode || 'production';
26 const __DEV__ = mode !== 'production';
27 const PORT = pkg.dev['dev-server-port'];
28 const autoRestart = options.autoRestart || false;
29
30 const outdir = __DEV__ ? path.join(__dirname, 'src') : path.join(__dirname, 'build');
31
32 const env: Record<string, string> = __DEV__
33 ? {
34 'process.env.APP_RENDER_URL': JSON.stringify(`http://localhost:${PORT}`),
35 'process.env.HIDDEN_BROWSER_WINDOW_URL': JSON.stringify(`http://localhost:${PORT}/hidden-window.html`),
36 'process.env.NODE_ENV': JSON.stringify('development'),
37 'process.env.INSOMNIA_ENV': JSON.stringify('development'),
38 'process.env.BUILD_DATE': JSON.stringify(new Date()),
39 }
40 : {
41 'process.env.NODE_ENV': JSON.stringify('production'),
42 'process.env.INSOMNIA_ENV': JSON.stringify('production'),
43 'process.env.BUILD_DATE': JSON.stringify(new Date()),
44 };
45
46 const preloadBuildOptions: BuildOptions = {
47 entryPoints: ['./src/entry.preload.ts'],
48 outfile: path.join(outdir, 'entry.preload.min.js'),
49 target: 'esnext',
50 bundle: true,
51 platform: 'node',
52 sourcemap: true,
53 format: 'cjs',
54 external: ['electron'],
55 };
56
57 const hiddenBrowserWindowPreloadBuildOptions: BuildOptions = {
58 entryPoints: ['./src/entry.hidden-window-preload.ts'],
59 outfile: path.join(outdir, 'entry.hidden-window-preload.min.js'),
60 target: 'esnext',
61 bundle: true,
62 platform: 'node',
63 sourcemap: true,
64 format: 'cjs',
65 external: ['electron'],
66 loader: {
67 '.node': 'copy',
68 },
69 };
70
71 const hiddenBrowserWindowBuildOptions: BuildOptions = {
72 entryPoints: ['./src/entry.hidden-window.ts'],
73 outfile: path.join(outdir, 'entry.hidden-window.min.js'),
74 target: 'esnext',
75 bundle: true,
76 platform: 'node',
77 sourcemap: true,
78 format: 'cjs',
79 // TODO: remove below, This indicates that libcurl is being imported when it shouldn't be
80 external: ['electron'],
81 loader: {

Callers 3

buildWithDebugFunction · 0.90
esbuild.tsFile · 0.90

Calls 6

restartElectronPluginFunction · 0.85
stringifyMethod · 0.80
keysMethod · 0.65
allMethod · 0.65
logMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected