diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-12-30 00:26:01 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-12-30 02:24:28 +0100 |
commit | 61fd13c55f5e69a9d8b32dd0d74b08870783bcce (patch) | |
tree | 4f3f97b1629f3c262bea076b596bc7245ccbc0bd /packages/main/esbuild.config.js | |
parent | Revert "refactor: Switch back to consola for prettyness" (diff) | |
download | sophie-61fd13c55f5e69a9d8b32dd0d74b08870783bcce.tar.gz sophie-61fd13c55f5e69a9d8b32dd0d74b08870783bcce.tar.zst sophie-61fd13c55f5e69a9d8b32dd0d74b08870783bcce.zip |
build: Switch to esbuild
We will build all packages except the frontend (where vite remains in
use) with esbuild.
For some reason, the @yarnpkg/esbuild-plugin-pnp doesn't allow esbuild
to load esm modules and we fall back to commonjs for dependencies.
Hence we had to switch back to node_modules (but still rely on yarn
hardlinking for a more efficient install).
Diffstat (limited to 'packages/main/esbuild.config.js')
-rw-r--r-- | packages/main/esbuild.config.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/main/esbuild.config.js b/packages/main/esbuild.config.js new file mode 100644 index 0000000..7653078 --- /dev/null +++ b/packages/main/esbuild.config.js | |||
@@ -0,0 +1,24 @@ | |||
1 | // @ts-check | ||
2 | |||
3 | const { node } = require('../../config/build-common'); | ||
4 | const { getConfig } = require('../../config/esbuild-config'); | ||
5 | |||
6 | const externalPackages = ['electron']; | ||
7 | |||
8 | if (process.env.MODE !== 'development') { | ||
9 | externalPackages.push('electron-devtools-installer'); | ||
10 | } | ||
11 | |||
12 | module.exports = getConfig({ | ||
13 | absWorkingDir: __dirname, | ||
14 | entryPoints: [ | ||
15 | 'src/index.ts', | ||
16 | ], | ||
17 | outfile: 'dist/index.cjs', | ||
18 | format: 'cjs', | ||
19 | platform: 'node', | ||
20 | target: node, | ||
21 | external: externalPackages, | ||
22 | }, { | ||
23 | VITE_DEV_SERVER_URL: process.env.VITE_DEV_SERVER_URL || null, | ||
24 | }); | ||