@aiready/visualizer 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web/vite.config.ts +17 -4
package/package.json
CHANGED
package/web/vite.config.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
3
|
import react from '@vitejs/plugin-react';
|
|
4
|
-
import tailwindcss from '@tailwindcss/vite';
|
|
5
4
|
import { existsSync } from 'fs';
|
|
6
5
|
|
|
7
|
-
export default defineConfig(({ command }) => {
|
|
6
|
+
export default defineConfig(async ({ command }) => {
|
|
8
7
|
const isDev = command === 'serve';
|
|
9
|
-
|
|
8
|
+
|
|
10
9
|
// Resolve path to @aiready/components for alias
|
|
11
10
|
// Try monorepo first, then fall back to installed package
|
|
12
11
|
let componentsPath = resolve(__dirname, '../../components/src');
|
|
@@ -21,8 +20,22 @@ export default defineConfig(({ command }) => {
|
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
const plugins: any[] = [react()];
|
|
24
|
+
// Try to dynamically import Tailwind Vite plugin. If it's not installed,
|
|
25
|
+
// continue without it so consumers who don't use Tailwind won't error.
|
|
26
|
+
try {
|
|
27
|
+
// import may return a module with a default export or the function itself
|
|
28
|
+
const mod = await import('@tailwindcss/vite');
|
|
29
|
+
const fn = mod?.default ?? mod;
|
|
30
|
+
if (typeof fn === 'function') {
|
|
31
|
+
plugins.push(fn());
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// plugin not available; proceed without Tailwind integration
|
|
35
|
+
}
|
|
36
|
+
|
|
24
37
|
return {
|
|
25
|
-
plugins
|
|
38
|
+
plugins,
|
|
26
39
|
build: {
|
|
27
40
|
outDir: 'dist',
|
|
28
41
|
emptyOutDir: true,
|