diff options
author | 2021-12-30 00:26:01 +0100 | |
---|---|---|
committer | 2021-12-30 02:24:28 +0100 | |
commit | 61fd13c55f5e69a9d8b32dd0d74b08870783bcce (patch) | |
tree | 4f3f97b1629f3c262bea076b596bc7245ccbc0bd /packages/main/vite.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/vite.config.js')
-rw-r--r-- | packages/main/vite.config.js | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/packages/main/vite.config.js b/packages/main/vite.config.js deleted file mode 100644 index bdb0ca1..0000000 --- a/packages/main/vite.config.js +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | // @ts-check | ||
2 | |||
3 | import { builtinModules } from 'module'; | ||
4 | |||
5 | import { makeConfig, node } from '../../config/vite-common'; | ||
6 | |||
7 | /** @type {string} */ | ||
8 | const PACKAGE_ROOT = __dirname; | ||
9 | |||
10 | /** | ||
11 | * @type {import('vite').UserConfig} | ||
12 | * @see https://vitejs.dev/config/ | ||
13 | */ | ||
14 | const config = makeConfig({ | ||
15 | root: PACKAGE_ROOT, | ||
16 | define: { | ||
17 | // Allow access to process.env in imported packages. | ||
18 | // https://github.com/vitejs/vite/issues/3176#issuecomment-876610206 | ||
19 | 'process.env': 'process["env"]', | ||
20 | 'global.process.env': 'global.process["env"]', | ||
21 | 'globalThis.process.env': 'globalThis.process["env"]', | ||
22 | }, | ||
23 | build: { | ||
24 | target: node, | ||
25 | lib: { | ||
26 | entry: 'src/index.ts', | ||
27 | formats: ['cjs'], | ||
28 | }, | ||
29 | rollupOptions: { | ||
30 | external: [ | ||
31 | 'electron', | ||
32 | 'electron-devtools-installer', | ||
33 | ...builtinModules, | ||
34 | ], | ||
35 | }, | ||
36 | }, | ||
37 | }); | ||
38 | |||
39 | export default config; | ||