File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
fixtures/webstudio-features Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,35 @@ import { defineConfig } from "vite";
3
3
import { reactRouter } from "@react-router/dev/vite" ;
4
4
// @ts -ignore
5
5
import { dedupeMeta } from "./proxy-emulator/dedupe-meta" ;
6
+ import { existsSync , readdirSync } from "fs" ;
7
+ // @ts -ignore
8
+ import path from "path" ;
9
+
10
+ const isFolderEmpty = ( folderPath : string ) => {
11
+ if ( ! existsSync ( folderPath ) ) {
12
+ return true ; // Folder does not exist
13
+ }
14
+ const contents = readdirSync ( folderPath ) ;
15
+
16
+ return contents . length === 0 ;
17
+ } ;
18
+
19
+ const hasPrivateFolders = ! isFolderEmpty (
20
+ path . join ( __dirname , "../../packages/sdk-components-animation/private-src" )
21
+ ) ;
22
+
23
+ const conditions = hasPrivateFolders
24
+ ? [ "webstudio-private" , "webstudio" ]
25
+ : [ "webstudio" ] ;
6
26
7
27
export default defineConfig ( {
28
+ resolve : {
29
+ conditions,
30
+ } ,
31
+ ssr : {
32
+ resolve : {
33
+ conditions,
34
+ } ,
35
+ } ,
8
36
plugins : [ reactRouter ( ) , dedupeMeta ] ,
9
37
} ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,35 @@ import { defineConfig } from "vite";
3
3
import { reactRouter } from "@react-router/dev/vite" ;
4
4
// @ts -ignore
5
5
import { dedupeMeta } from "./proxy-emulator/dedupe-meta" ;
6
+ import { existsSync , readdirSync } from "fs" ;
7
+ // @ts -ignore
8
+ import path from "path" ;
9
+
10
+ const isFolderEmpty = ( folderPath : string ) => {
11
+ if ( ! existsSync ( folderPath ) ) {
12
+ return true ; // Folder does not exist
13
+ }
14
+ const contents = readdirSync ( folderPath ) ;
15
+
16
+ return contents . length === 0 ;
17
+ } ;
18
+
19
+ const hasPrivateFolders = ! isFolderEmpty (
20
+ path . join ( __dirname , "../../packages/sdk-components-animation/private-src" )
21
+ ) ;
22
+
23
+ const conditions = hasPrivateFolders
24
+ ? [ "webstudio-private" , "webstudio" ]
25
+ : [ "webstudio" ] ;
6
26
7
27
export default defineConfig ( {
28
+ resolve : {
29
+ conditions,
30
+ } ,
31
+ ssr : {
32
+ resolve : {
33
+ conditions,
34
+ } ,
35
+ } ,
8
36
plugins : [ reactRouter ( ) , dedupeMeta ] ,
9
37
} ) ;
You can’t perform that action at this time.
0 commit comments