Skip to content

Commit f2f2fe7

Browse files
Merge pull request #3289 from RedisInsight/build/move_to_vite
#CR-10 - Move to vite
2 parents 560210c + db617e4 commit f2f2fe7

File tree

193 files changed

+4188
-3322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+4188
-3322
lines changed

.circleci/build/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ yarn --cwd redisinsight/api
77

88
# build
99
yarn build:statics
10-
yarn build:web
10+
yarn build:ui
1111
yarn --cwd ./redisinsight/api build:prod

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ redisinsight/api/commands
5050
redisinsight/api/guides
5151
redisinsight/api/tutorials
5252
redisinsight/api/content
53+
redisinsight/ui/dist-stats.html
5354
dist
5455
distWeb
5556
dll

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ COPY redisinsight ./redisinsight
2929
RUN yarn --cwd redisinsight/api install
3030

3131
# build the frontend, static assets, and backend api
32-
RUN yarn build:web
32+
RUN yarn build:ui
3333
RUN yarn build:statics
3434
RUN yarn build:api
3535

babel.config.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const developmentEnv = ['development', 'test'];
44

55
const developmentPlugins = [
66
require('@babel/plugin-transform-runtime'),
7-
require('react-hot-loader/babel'),
87
];
98

109
const productionPlugins = [

configs/webpack.config.renderer.dev.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ const configuration: webpack.Configuration = {
7676
plugins: [require.resolve('react-refresh/babel')].filter(Boolean),
7777
},
7878
},
79+
{
80+
loader: 'string-replace-loader',
81+
options: {
82+
search: /import (\w+) from '(.+?)\.svg\?react'/g,
83+
replace: "import { ReactComponent as $1 } from '$2.svg'",
84+
},
85+
}
7986
],
8087
},
8188
{
@@ -95,6 +102,10 @@ const configuration: webpack.Configuration = {
95102
loader: 'sass-loader',
96103
options: {
97104
sourceMap: true,
105+
additionalData: `
106+
@use "uiSrc/styles/mixins/_eui.scss";
107+
@use "uiSrc/styles/mixins/_global.scss";
108+
`
98109
},
99110
},
100111
],
@@ -113,6 +124,10 @@ const configuration: webpack.Configuration = {
113124
loader: 'sass-loader',
114125
options: {
115126
sourceMap: true,
127+
additionalData: `
128+
@use "uiSrc/styles/mixins/_eui.scss";
129+
@use "uiSrc/styles/mixins/_global.scss";
130+
`
116131
},
117132
},
118133
],

configs/webpack.config.renderer.prod.ts

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,60 +44,77 @@ const configuration: webpack.Configuration = {
4444
module: {
4545
rules: [
4646
{
47-
test: /\.module\.s(a|c)ss$/,
47+
test: /\.[jt]sx?$/,
48+
exclude: /node_modules/,
4849
use: [
4950
{
50-
loader: MiniCssExtractPlugin.loader,
51-
},
52-
{
53-
loader: 'css-loader',
51+
loader: 'babel-loader',
5452
options: {
55-
modules: true,
56-
sourceMap: false,
53+
cacheDirectory: false,
5754
},
5855
},
5956
{
60-
loader: 'sass-loader',
57+
loader: 'string-replace-loader',
6158
options: {
62-
sourceMap: false,
59+
search: /import (\w+) from '(.+?)\.svg\?react'/g,
60+
replace: "import { ReactComponent as $1 } from '$2.svg'",
6361
},
64-
},
62+
}
6563
],
6664
},
6765
{
68-
test: /\.s(a|c)ss$/,
69-
exclude: [/\.module.(s(a|c)ss)$/, /\.lazy\.s(a|c)ss$/i],
66+
test: /\.module\.s(a|c)ss$/,
7067
use: [
7168
{
7269
loader: MiniCssExtractPlugin.loader,
7370
},
7471
{
7572
loader: 'css-loader',
73+
options: {
74+
modules: true,
75+
sourceMap: false,
76+
},
7677
},
7778
{
7879
loader: 'sass-loader',
7980
options: {
8081
sourceMap: false,
82+
additionalData: `
83+
@use "uiSrc/styles/mixins/_eui.scss";
84+
@use "uiSrc/styles/mixins/_global.scss";
85+
`
8186
},
8287
},
8388
],
8489
},
85-
// SASS lazy support
8690
{
87-
test: /\.lazy\.s(a|c)ss$/i,
91+
test: /\/(dark|light)Theme.scss/,
92+
use: [
93+
'raw-loader',
94+
'sass-loader',
95+
]
96+
},
97+
{
98+
test: /\.s(a|c)ss$/,
99+
exclude: [/\.module.(s(a|c)ss)$/, /\/(dark|light)Theme.scss/],
88100
use: [
89101
{
90-
loader: 'style-loader',
91-
options: { injectType: 'lazySingletonStyleTag' },
102+
loader: MiniCssExtractPlugin.loader,
92103
},
93104
{
94105
loader: 'css-loader',
95106
},
96107
{
97108
loader: 'sass-loader',
109+
options: {
110+
sourceMap: false,
111+
additionalData: `
112+
@use "uiSrc/styles/mixins/_eui.scss";
113+
@use "uiSrc/styles/mixins/_global.scss";
114+
`
115+
},
98116
},
99117
],
100-
exclude: /node_modules/,
101118
},
102119
{
103120
test: /\.css$/,
@@ -217,6 +234,9 @@ const configuration: webpack.Configuration = {
217234
'process.env.RI_SEGMENT_WRITE_KEY': 'RI_SEGMENT_WRITE_KEY' in process.env
218235
? JSON.stringify(process.env.RI_SEGMENT_WRITE_KEY)
219236
: JSON.stringify('SOURCE_WRITE_KEY'),
237+
'process.env.NODE_DEBUG': 'NODE_DEBUG' in process.env
238+
? JSON.stringify(process.env.NODE_DEBUG)
239+
: JSON.stringify(''),
220240
}),
221241
],
222242
};

configs/webpack.config.web.common.ts

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,21 @@ export default {
2424
webpackPaths.apiPath,
2525
webpackPaths.desktopPath,
2626
],
27-
use: {
28-
loader: 'babel-loader',
29-
options: {
30-
cacheDirectory: true,
27+
use: [
28+
{
29+
loader: 'babel-loader',
30+
options: {
31+
cacheDirectory: true,
32+
},
3133
},
32-
},
34+
{
35+
loader: 'string-replace-loader',
36+
options: {
37+
search: /import (\w+) from '(.+?)\.svg\?react'/g,
38+
replace: "import { ReactComponent as $1 } from '$2.svg'",
39+
},
40+
},
41+
]
3342
},
3443
{
3544
test: /\.svg$/,
@@ -43,6 +52,18 @@ export default {
4352
],
4453
},
4554

55+
ignoreWarnings: [
56+
{
57+
module: /elastic.scss/,
58+
},
59+
{
60+
module: /QueryCardHeader/,
61+
},
62+
{
63+
module: /\/(dark|light)Theme.scss/,
64+
},
65+
],
66+
4667
context: webpackPaths.uiPath,
4768

4869
/**

0 commit comments

Comments
 (0)