Skip to content

Commit f5a3741

Browse files
authored
chore: Add dev pages bundle to build artifacts (#137)
* Build dev pages * Refine config * Exclude React * Do not exclude React * Refine config * Exclude Highcharts
1 parent 2da60cb commit f5a3741

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

package.json

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

vite.config.dev-pages.mjs

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

0 commit comments

Comments
 (0)