-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathvite.config.ts
52 lines (49 loc) · 1.16 KB
/
vite.config.ts
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import {resolve} from 'path';
import {defineConfig, type Plugin} from 'vite';
import dts from 'vite-plugin-dts';
import solidPlugin from 'vite-plugin-solid';
import {dependencies, peerDependencies} from './package.json';
const externals = [
...Object.keys(dependencies),
...Object.keys(peerDependencies),
'solid-js/web',
'solid-js/store',
];
export function removeSideEffects(): Plugin {
return {
name: 'fix-treeshaking',
transform() {
return {
moduleSideEffects: 'no-treeshake',
};
},
};
}
export default defineConfig({
plugins: [
solidPlugin(),
dts({
skipDiagnostics: false,
logDiagnostics: true,
outputDir: './dist/types',
}),
// TODO: check possible issues --> why solid-js and @vanilla-extract/dynamic are imported in some files?
removeSideEffects(),
],
build: {
lib: {
entry: resolve(__dirname, 'src/index.tsx'),
name: '@codeimage/ui',
fileName: 'ui',
formats: ['es', 'cjs'],
},
target: 'esnext',
rollupOptions: {
external: externals,
output: {
entryFileNames: '[name].js',
preserveModules: true,
},
},
},
});