-
Notifications
You must be signed in to change notification settings - Fork 10
/
vite.config.js
49 lines (48 loc) · 1.54 KB
/
vite.config.js
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
import path from 'path';
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import {vanillaExtractPlugin} from '@vanilla-extract/vite-plugin';
import noBundlePlugin from 'vite-plugin-no-bundle';
import preserveDirectivesPlugin from 'rollup-plugin-preserve-directives';
export default defineConfig({
plugins: [
react(),
vanillaExtractPlugin(),
noBundlePlugin({
// Change .css.js files to something else so that they don't get re-processed by consumer apps using vanilla extract too
fileNames: ({name}) => `${name.replace(/\.css$/, '.css-mistica')}.js`,
}),
{
...preserveDirectivesPlugin(),
enforce: 'post',
apply: 'build',
},
],
resolve: {
alias: {
// forbid lodash usage
lodash: '/dev/null',
'lodash-es': '/dev/null',
},
},
publicDir: false,
build: {
lib: {
entry: [
path.resolve(__dirname, 'src', 'index.tsx'),
path.resolve(__dirname, 'src', 'community', 'index.tsx'),
],
formats: ['es'],
},
outDir: 'dist-es',
// https://github.com/vitejs/vite/issues/15012#issuecomment-1815854072
rollupOptions: {
onLog(level, log, handler) {
if (log.cause && log.cause.message === `Can't resolve original location of error.`) {
return;
}
handler(level, log);
},
},
},
});