fix(x402): add tsdown config to build middleware entry point (#48)
* fix(x402): add tsdown config to build middleware entry point * adds optimizeDeps.exclude and ssr.optimizeDeps.exclude for @emdash-cms/x402 in the integration's Vite config * fix CI typecheck --------- Co-authored-by: Matt Kane <mkane@cloudflare.com>
This commit is contained in:
@@ -49,7 +49,9 @@ export function x402(config: X402Config): AstroIntegration {
|
||||
name: "@emdash-cms/x402",
|
||||
hooks: {
|
||||
"astro:config:setup": ({ addMiddleware, updateConfig }) => {
|
||||
// Inject the virtual module that provides config to the middleware
|
||||
// Inject the virtual module that provides config to the middleware.
|
||||
// The middleware must be excluded from Vite's SSR dependency optimizer
|
||||
// because esbuild cannot resolve virtual modules — only Vite plugins can.
|
||||
updateConfig({
|
||||
vite: {
|
||||
plugins: [
|
||||
@@ -65,6 +67,14 @@ export function x402(config: X402Config): AstroIntegration {
|
||||
},
|
||||
},
|
||||
],
|
||||
optimizeDeps: {
|
||||
exclude: ["@emdash-cms/x402"],
|
||||
},
|
||||
ssr: {
|
||||
optimizeDeps: {
|
||||
exclude: ["@emdash-cms/x402"],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
10
packages/x402/tsdown.config.ts
Normal file
10
packages/x402/tsdown.config.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { defineConfig } from "tsdown";
|
||||
|
||||
export default defineConfig({
|
||||
entry: ["src/index.ts", "src/middleware.ts"],
|
||||
format: ["esm"],
|
||||
dts: true,
|
||||
clean: true,
|
||||
inlineOnly: false,
|
||||
external: ["astro:middleware", "virtual:x402/config"],
|
||||
});
|
||||
Reference in New Issue
Block a user