Skip to content

Commit 1aac186

Browse files
committed
chore: Add dev pages bundle to build artifacts
1 parent 2795450 commit 1aac186

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"build:src:environment": "node scripts/environment",
3737
"build:themeable": "node scripts/themeable-source",
3838
"build:pages:vite": "vite build",
39-
"build:pages:tsc": "tsc -p pages/tsconfig.json"
39+
"build:pages:tsc": "tsc -p pages/tsconfig.json",
40+
"build:pages:bundle": "vite build -c vite.config.dev-pages.mjs"
4041
},
4142
"exports": {
4243
".": "./index.js",

vite.config.dev-pages.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
import { dirname, resolve } from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
6+
import react from "@vitejs/plugin-react";
7+
import { defineConfig } from "vite";
8+
9+
const __dirname = dirname(fileURLToPath(import.meta.url));
10+
11+
const componentsPath = resolve(__dirname, "lib/components");
12+
13+
// https://vitejs.dev/config/
14+
export default defineConfig({
15+
plugins: [react({ fastRefresh: false })],
16+
resolve: {
17+
alias: {
18+
lodash: "lodash-es",
19+
},
20+
},
21+
build: {
22+
lib: {
23+
entry: resolve(__dirname, "pages/main.tsx"),
24+
name: "ChatComponentsDevPages",
25+
fileName: "main",
26+
},
27+
outDir: "lib/dev-pages/bundle",
28+
rollupOptions: {
29+
external: [componentsPath, /^@cloudscape-design\/*/, "react"],
30+
},
31+
},
32+
});

0 commit comments

Comments
 (0)