Skip to content

Commit c74568e

Browse files
committed
Refine config
1 parent a3d9722 commit c74568e

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

dev/globals.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
import * as chatComponents from "../lib/components";
4+
5+
Object.assign(window as unknown as Record<string, any>, {
6+
chatComponents,
7+
});

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.dev-pages.mjs && cp pages/index.html lib/dev-pages"
40+
"build:pages:lib": "vite build -c vite.config.dev-pages.mjs"
4141
},
4242
"exports": {
4343
".": "./index.js",

vite.config.dev-pages.mjs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
1010

1111
const chatComponentsPath = resolve(__dirname, "lib/components");
1212

13-
const globalPackages = {
14-
react: "React",
15-
"react-dom": "ReactDOM",
16-
"react/jsx-runtime": "jsxRuntime",
17-
"@cloudscape-design/components": "components",
18-
"@cloudscape-design/global-styles": "globalStyles",
19-
"@cloudscape-design/component-toolkit": "componentToolkit",
20-
};
21-
22-
const globals = { [chatComponentsPath]: "chatComponents", ...globalPackages };
13+
const globals = { [chatComponentsPath]: "chatComponents" };
2314

2415
// https://vitejs.dev/config/
2516
export default defineConfig({
@@ -37,7 +28,7 @@ export default defineConfig({
3728
},
3829
outDir: "lib/dev-pages/bundle",
3930
rollupOptions: {
40-
external: [chatComponentsPath, ...Object.keys(globalPackages)],
31+
external: [chatComponentsPath],
4132
output: {
4233
globals,
4334
},

0 commit comments

Comments
 (0)