@@ -5,12 +5,20 @@ import { fileURLToPath } from "node:url";
55import react from "@vitejs/plugin-react" ;
66import { defineConfig } from "vite" ;
77
8- const componentsPath = fileURLToPath ( new URL ( "lib/components" , import . meta. url ) ) ;
8+ const componentsPath = fileURLToPath ( new URL ( "../lib/components" , import . meta. url ) ) ;
9+ const globalPackages = {
10+ "@cloudscape-design/components" : "components" ,
11+ "@cloudscape-design/global-styles" : "global-styles" ,
12+ "@cloudscape-design/collection-hooks" : "collection-hooks" ,
13+ "@cloudscape-design/component-toolkit" : "component-toolkit" ,
14+ "@cloudscape-design/design-tokens" : "design-tokens" ,
15+ "@cloudscape-design/theming-runtime" : "theming-runtime" ,
16+ } ;
917
1018// https://vitejs.dev/config/
1119export default defineConfig ( {
1220 plugins : [ react ( { fastRefresh : false } ) ] ,
13- root : "./pages " ,
21+ root : "./" ,
1422 base : "./" ,
1523 resolve : {
1624 alias : {
@@ -20,9 +28,10 @@ export default defineConfig({
2028 build : {
2129 outDir : "../lib/dev-pages/pages" ,
2230 rollupOptions : {
23- external : [ componentsPath ] ,
31+ external : [ componentsPath , ... Object . keys ( globalPackages ) ] ,
2432 output : {
25- globals : { componentsPath : "components" } ,
33+ globals : { [ componentsPath ] : "chat-components" , ...globalPackages } ,
34+ format : "iife" ,
2635 } ,
2736 } ,
2837 } ,
0 commit comments