diff options
author | 2021-12-23 00:43:55 +0100 | |
---|---|---|
committer | 2021-12-23 01:17:18 +0100 | |
commit | cf23e60c17763123caa77f1194e6efd913692ea1 (patch) | |
tree | 42266377ac1a65a9b225737c8cbef02c6b1871cd /packages/shared/vite.config.js | |
parent | feat: Add mui (diff) | |
download | sophie-cf23e60c17763123caa77f1194e6efd913692ea1.tar.gz sophie-cf23e60c17763123caa77f1194e6efd913692ea1.tar.zst sophie-cf23e60c17763123caa77f1194e6efd913692ea1.zip |
feat: Add shared package for electron ipc
Diffstat (limited to 'packages/shared/vite.config.js')
-rw-r--r-- | packages/shared/vite.config.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/packages/shared/vite.config.js b/packages/shared/vite.config.js new file mode 100644 index 0000000..cbebb8a --- /dev/null +++ b/packages/shared/vite.config.js | |||
@@ -0,0 +1,44 @@ | |||
1 | // @ts-check | ||
2 | |||
3 | import { builtinModules } from 'module'; | ||
4 | |||
5 | // `resolveJsonModule` is disabled for this package, but vite will load the json nevertheless. | ||
6 | // @ts-expect-error | ||
7 | import { chrome, node } from '../../.electron-vendors.cache.json'; | ||
8 | |||
9 | /** @type string */ | ||
10 | const PACKAGE_ROOT = __dirname; | ||
11 | |||
12 | /** | ||
13 | * @type {import('vite').UserConfig} | ||
14 | * @see https://vitejs.dev/config/ | ||
15 | */ | ||
16 | const config = { | ||
17 | mode: process.env.MODE, | ||
18 | root: PACKAGE_ROOT, | ||
19 | envDir: process.cwd(), | ||
20 | build: { | ||
21 | sourcemap: 'inline', | ||
22 | target: [ | ||
23 | `chrome${chrome}`, | ||
24 | `node${node}` | ||
25 | ], | ||
26 | outDir: 'dist', | ||
27 | lib: { | ||
28 | entry: 'src/index.ts', | ||
29 | formats: ['cjs'], | ||
30 | }, | ||
31 | rollupOptions: { | ||
32 | external: [ | ||
33 | ...builtinModules, | ||
34 | ], | ||
35 | output: { | ||
36 | entryFileNames: '[name].cjs', | ||
37 | }, | ||
38 | }, | ||
39 | emptyOutDir: false, // Do not remove `.d.ts` files. | ||
40 | brotliSize: false, | ||
41 | }, | ||
42 | }; | ||
43 | |||
44 | export default config; | ||