-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set Up dev 'watch' for aiconfig-editor declarations HMR
- Loading branch information
Ryan Holinshead
committed
Jan 18, 2024
1 parent
0bd50b3
commit 253fec4
Showing
15 changed files
with
119 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
python/src/aiconfig/editor/client/aiconfig-editor/vite.config.dev.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { PROD_CONFIG } from "./vite.config"; | ||
import { LibraryOptions, defineConfig } from "vite"; | ||
|
||
// vite build --watch expects a watch/index.html entrypoing even for library builds. | ||
// But setting 'watch' in build config is an alternate way to watch changes to files, | ||
// so use this dev config for dev builds. | ||
export default defineConfig({ | ||
...PROD_CONFIG, | ||
build: { | ||
...PROD_CONFIG.build, | ||
lib: { | ||
...(PROD_CONFIG.build!.lib as LibraryOptions), | ||
formats: ["es"], // LocalEditor only needs uses ES module format | ||
}, | ||
watch: { | ||
include: "src/**", // Watches the specified files for changes. | ||
}, | ||
}, | ||
}); |
12 changes: 8 additions & 4 deletions
12
python/src/aiconfig/editor/client/aiconfig-editor/vite.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import { defineConfig } from "vite"; | ||
import { resolve } from "path"; | ||
import { UserConfig, defineConfig } from "vite"; | ||
import dts from "vite-plugin-dts"; | ||
|
||
export default defineConfig({ | ||
export const PROD_CONFIG: UserConfig = { | ||
build: { | ||
lib: { | ||
entry: "./src/index.ts", // Specifies the entry point for building the library. | ||
entry: resolve(__dirname, "/src/index.ts"), // Specifies the entry point for building the library. | ||
name: "aiconfig-editor", // Sets the name of the generated library. | ||
fileName: (format) => `index.${format}.js`, // Generates the output file name based on the format. | ||
formats: ["cjs", "es"], // Specifies the output formats (CommonJS and ES modules). | ||
}, | ||
rollupOptions: { | ||
external: ["react", "react-dom"], // Defines external dependencies for Rollup bundling. | ||
input: resolve(__dirname, "src/index.ts"), // Specifies the entry point for Rollup bundling. | ||
}, | ||
sourcemap: true, // Generates source maps for debugging. | ||
emptyOutDir: true, // Clears the output directory before building. | ||
}, | ||
plugins: [dts()], // Uses the 'vite-plugin-dts' plugin for generating TypeScript declaration files (d.ts). | ||
}); | ||
}; | ||
|
||
export default defineConfig(PROD_CONFIG); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"files": { | ||
"main.js": "/static/js/main.19541bdf.js", | ||
"main.js": "/static/js/main.e40a27c0.js", | ||
"index.html": "/index.html", | ||
"main.19541bdf.js.map": "/static/js/main.19541bdf.js.map" | ||
"main.e40a27c0.js.map": "/static/js/main.e40a27c0.js.map" | ||
}, | ||
"entrypoints": [ | ||
"static/js/main.19541bdf.js" | ||
"static/js/main.e40a27c0.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>AIConfig Editor</title><script defer="defer" src="/static/js/main.19541bdf.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>AIConfig Editor</title><script defer="defer" src="/static/js/main.e40a27c0.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> |
3 changes: 0 additions & 3 deletions
3
python/src/aiconfig/editor/server/static/static/js/main.19541bdf.js
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
python/src/aiconfig/editor/server/static/static/js/main.19541bdf.js.map
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
python/src/aiconfig/editor/server/static/static/js/main.e40a27c0.js
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
python/src/aiconfig/editor/server/static/static/js/main.e40a27c0.js.map
Large diffs are not rendered by default.
Oops, something went wrong.