Skip to content

Commit 4c6983b

Browse files
authored
Fe/feature/ri 7039 replace eui build fix 2 (#4721)
* fix for the builds failing with redis ui * fix for the builds failing with redis ui
1 parent 483390b commit 4c6983b

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

redisinsight/ui/src/packages/vite.config.mjs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import react from '@vitejs/plugin-react';
44
import svgr from 'vite-plugin-svgr';
55
import { ViteEjsPlugin } from 'vite-plugin-ejs';
66
import { viteStaticCopy } from 'vite-plugin-static-copy';
7-
import { resolve } from 'path';
8-
import { fileURLToPath } from 'url';
7+
import path, { resolve } from 'path'
8+
import { fileURLToPath } from 'url'
99

1010
const riPlugins = [
1111
{ name: 'redisearch', entry: 'src/main.tsx' },
@@ -83,6 +83,32 @@ export default defineConfig({
8383
this: 'window',
8484
},
8585
},
86+
css: {
87+
preprocessorOptions: {
88+
scss: {
89+
// add @layer app for css ordering. Styles without layer have the highest priority
90+
// https://github.com/vitejs/vite/issues/3924
91+
additionalData: (source, filename) => {
92+
if (path.extname(filename) === '.scss') {
93+
const skipFiles = [
94+
'/main.scss',
95+
'/App.scss',
96+
'/packages/clients-list/src/styles/styles.scss',
97+
'/packages/redisearch/src/styles/styles.scss'
98+
];
99+
if (skipFiles.every((file) => !filename.endsWith(file))) {
100+
return `
101+
@use "uiSrc/styles/mixins/_eui.scss";
102+
@use "uiSrc/styles/mixins/_global.scss";
103+
@layer app { ${source} }
104+
`;
105+
}
106+
}
107+
return source;
108+
},
109+
},
110+
},
111+
},
86112
define: {
87113
global: 'globalThis',
88114
'process.env': {},

0 commit comments

Comments
 (0)