Skip to content

Commit

Permalink
Fix astro integration
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown committed Sep 5, 2023
1 parent 196daee commit 9022773
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-toys-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystatic/astro': patch
---

Fix integration
6 changes: 6 additions & 0 deletions packages/astro/internal/for-optimize-deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// this file is to get vite to scan these imports when pre-bundling dependencies
// so that e.g. importing CJS packages works
// https://vitejs.dev/guide/dep-pre-bundling.html
import '@keystatic/astro/ui';
import '@keystatic/astro/api';
import '@keystatic/core/ui';
6 changes: 4 additions & 2 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
},
"./package.json": "./package.json",
"./internal/keystatic-api.js": "./internal/keystatic-api.js",
"./internal/keystatic-astro-page.astro": "./internal/keystatic-astro-page.astro"
"./internal/keystatic-astro-page.astro": "./internal/keystatic-astro-page.astro",
"./internal/for-optimize-deps": "./internal/for-optimize-deps.js"
},
"keywords": [
"astro-integration"
Expand Down Expand Up @@ -74,7 +75,8 @@
"exports": {
"extra": {
"./internal/keystatic-api.js": "./internal/keystatic-api.js",
"./internal/keystatic-astro-page.astro": "./internal/keystatic-astro-page.astro"
"./internal/keystatic-astro-page.astro": "./internal/keystatic-astro-page.astro",
"./internal/for-optimise-deps": "./internal/for-optimise-deps.js"
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/astro/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export default function keystatic(): AstroIntegration {
},
},
],
optimizeDeps: {
entries: [
require.resolve('@keystatic/astro/internal/for-optimize-deps'),
],
},
};
updateConfig({
vite,
Expand Down

0 comments on commit 9022773

Please sign in to comment.