-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathastro.config.mjs
More file actions
48 lines (44 loc) · 1.22 KB
/
astro.config.mjs
File metadata and controls
48 lines (44 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { defineConfig } from "astro/config";
// Prevent duplicate customElements.define() errors in dev mode.
// The myst-awesome library imports Web Awesome components from many
// separate <script> entry points, which Astro/Vite can execute more
// than once. This patches define() to silently skip duplicates.
function safeCustomElements() {
return {
name: "safe-custom-elements",
hooks: {
"astro:config:setup"({ injectScript }) {
injectScript(
"head-inline",
`{
const orig = customElements.define.bind(customElements);
customElements.define = function (name, ctor, opts) {
if (!customElements.get(name)) orig(name, ctor, opts);
};
}`
);
},
},
};
}
export default defineConfig({
// Use the myst-awesome theme configuration
integrations: [safeCustomElements()],
server: {
port: 4321, // Use port 4321 for the main project
},
vite: {
// Configure module resolution
ssr: {
noExternal: ["@awesome.me/webawesome"],
},
optimizeDeps: {
exclude: [
"itk-wasm",
"@itk-wasm/mesh-io",
"@itk-wasm/image-io",
"@thewtex/zstddec",
],
},
},
});