-
Notifications
You must be signed in to change notification settings - Fork 428
/
vite.config.mjs
93 lines (88 loc) · 2.69 KB
/
vite.config.mjs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
* Configuration for Vite, used for Storybook.
*
* This configures the paths, plugins, and settings needed to serve up
* Storybook with Review Board.
*
* Version Added:
* 7.0
*/
import path from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
build: {
target: 'esnext',
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
modifyVars: {
'images-path': path.resolve(__dirname, 'src', 'ink',
'images'),
'tabler-path': path.resolve(__dirname, 'node_modules',
'\\@tabler', 'icons'),
},
paths: [
path.resolve(__dirname, 'reviewboard', 'static'),
path.resolve(__dirname, 'node_modules', '@beanbag',
'djblets', 'static'),
],
},
},
},
esbuild: {
target: 'esnext',
},
optimizeDeps: {
esbuildOptions: {
target: 'esnext',
},
},
plugins: [
react({
babel: {
/*
* This is strictly a subset of the plugins we use when
* building Review Board. We only want the ones we need for
* certain transforms and executions within the context of a
* Storybook Preview page. Anything else could lead to
* breakages.
*/
plugins: [
'@babel/plugin-external-helpers',
['@babel/plugin-proposal-decorators', {
'version': 'legacy'
}],
'babel-plugin-dedent',
'babel-plugin-django-gettext',
],
},
/*
* Limit this to our own code, so we don't run Storybook
* through it.
*/
include: /reviewboard\/static\/.*\.(js|jsx|ts|tsx)$/,
}),
],
resolve: {
alias: {
'reviewboard/common': path.resolve(
__dirname,
'reviewboard/static/rb/js/common/index.ts'),
'reviewboard/reviews': path.resolve(
__dirname,
'reviewboard/static/rb/js/reviews/index.ts'),
'reviewboard/ui': path.resolve(
__dirname,
'reviewboard/static/rb/js/ui/index.ts'),
},
},
ssr: {
noExternal: [
'@beanbag/ink',
'@beanbag/spina',
],
}
});