Skip to content

Commit a3d9722

Browse files
committed
Refine config
1 parent 461dd43 commit a3d9722

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"build:themeable": "node scripts/themeable-source",
3838
"build:pages:vite": "vite build",
3939
"build:pages:tsc": "tsc -p pages/tsconfig.json",
40-
"build:pages:lib": "vite build -c vite.config.pages.mjs"
40+
"build:pages:lib": "vite build -c vite.config.dev-pages.mjs && cp pages/index.html lib/dev-pages"
4141
},
4242
"exports": {
4343
".": "./index.js",
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@ import { defineConfig } from "vite";
88

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

11-
const chatComponentsPath = fileURLToPath(new URL("lib/components", import.meta.url));
11+
const chatComponentsPath = resolve(__dirname, "lib/components");
1212

1313
const globalPackages = {
14+
react: "React",
15+
"react-dom": "ReactDOM",
16+
"react/jsx-runtime": "jsxRuntime",
1417
"@cloudscape-design/components": "components",
1518
"@cloudscape-design/global-styles": "globalStyles",
1619
"@cloudscape-design/component-toolkit": "componentToolkit",
1720
};
1821

22+
const globals = { [chatComponentsPath]: "chatComponents", ...globalPackages };
23+
1924
// https://vitejs.dev/config/
2025
export default defineConfig({
2126
plugins: [react({ fastRefresh: false })],
@@ -34,7 +39,7 @@ export default defineConfig({
3439
rollupOptions: {
3540
external: [chatComponentsPath, ...Object.keys(globalPackages)],
3641
output: {
37-
globals: { [chatComponentsPath]: "chatComponents", ...globalPackages },
42+
globals,
3843
},
3944
},
4045
},

0 commit comments

Comments
 (0)