Skip to content

Commit f3a7214

Browse files
committed
Add React to globals
1 parent 351bd01 commit f3a7214

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

vite.config.dev-pages.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import { defineConfig } from "vite";
88

99
const __dirname = dirname(fileURLToPath(import.meta.url));
1010

11+
const componentsPath = resolve(__dirname, "lib/components");
12+
13+
const globals = { [componentsPath]: "components", react: "React" };
14+
1115
// https://vitejs.dev/config/
1216
export default defineConfig({
1317
plugins: [react({ fastRefresh: false })],
@@ -19,7 +23,10 @@ export default defineConfig({
1923
},
2024
outDir: "lib/dev-pages/bundle",
2125
rollupOptions: {
22-
external: [resolve(__dirname, "lib/components"), /^@cloudscape-design\/*/, "react"],
26+
external: [...Object.keys(globals), /^@cloudscape-design\/*/],
27+
output: {
28+
globals,
29+
},
2330
},
2431
},
2532
});

0 commit comments

Comments
 (0)