Skip to content

Commit a5284e4

Browse files
committed
Refine config
1 parent 53381d2 commit a5284e4

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

vite.config.pages.mjs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3+
import { dirname, resolve } from "node:path";
34
import { fileURLToPath } from "node:url";
45

56
import react from "@vitejs/plugin-react";
67
import { defineConfig } from "vite";
78

8-
const componentsPath = fileURLToPath(new URL("../lib/components", import.meta.url));
9+
const __dirname = dirname(fileURLToPath(import.meta.url));
10+
11+
const chatComponentsPath = fileURLToPath(new URL("../lib/components", import.meta.url));
12+
913
const globalPackages = {
1014
"@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",
15+
"@cloudscape-design/global-styles": "globalStyles",
16+
"@cloudscape-design/component-toolkit": "componentToolkit",
1617
};
1718

1819
// https://vitejs.dev/config/
1920
export default defineConfig({
2021
plugins: [react({ fastRefresh: false })],
21-
root: "./",
22-
base: "./",
2322
resolve: {
2423
alias: {
2524
lodash: "lodash-es",
2625
},
2726
},
2827
build: {
29-
outDir: "../lib/dev-pages/pages",
28+
lib: {
29+
entry: resolve(__dirname, "pages/main.tsx"),
30+
name: "ChatComponentsDevPages",
31+
fileName: "main",
32+
},
33+
outDir: "lib/dev-pages/bundle",
3034
rollupOptions: {
31-
external: [componentsPath, ...Object.keys(globalPackages)],
35+
external: [chatComponentsPath, ...Object.keys(globalPackages)],
3236
output: {
33-
globals: { [componentsPath]: "chat-components", ...globalPackages },
34-
format: "iife",
37+
globals: { [chatComponentsPath]: "chatComponents", ...globalPackages },
3538
},
3639
},
3740
},

0 commit comments

Comments
 (0)