forked from chatwoot/chatwoot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.lib.config.ts
More file actions
33 lines (32 loc) · 952 Bytes
/
Copy pathvite.lib.config.ts
File metadata and controls
33 lines (32 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* SDK library build.
*
* vite-plugin-ruby pulls every entrypoint as input, but the SDK needs to ship
* as a single IIFE file (`inlineDynamicImports: true`), which is incompatible
* with multiple entrypoints. So the SDK gets its own pipeline:
*
* vite build --config vite.lib.config.ts → public/packs/js/sdk.js
*
* The `assets:precompile` rake task runs this alongside the main app build.
*/
import { defineConfig } from 'vite';
import path from 'path';
import { aliases } from './vite.shared';
export default defineConfig({
build: {
rollupOptions: {
output: {
dir: 'public/packs',
entryFileNames: chunkInfo =>
chunkInfo.name === 'sdk' ? 'js/sdk.js' : '[name].js',
inlineDynamicImports: true,
},
},
lib: {
entry: path.resolve(__dirname, './app/javascript/entrypoints/sdk.js'),
formats: ['iife'],
name: 'sdk',
},
},
resolve: { alias: aliases },
});