Skip to content

Commit 53381d2

Browse files
committed
Fine tune config
1 parent a1060df commit 53381d2

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

vite.config.pages.mjs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ import { fileURLToPath } from "node:url";
55
import react from "@vitejs/plugin-react";
66
import { 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/
1119
export 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

Comments
 (0)