@standardagents/builder 0.9.7 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5849,43 +5849,50 @@ function agentbuilder(options = {}) {
5849
5849
  return {
5850
5850
  name: "vite-plugin-agent",
5851
5851
  config() {
5852
+ const depsToExclude = [
5853
+ "@standardagents/builder",
5854
+ "@standardagents/builder/runtime",
5855
+ "@standardagents/builder/built-in-routes",
5856
+ "@standardagents/builder/mcp"
5857
+ ];
5852
5858
  return {
5853
5859
  optimizeDeps: {
5854
- // Pre-bundle these deps upfront to prevent "new version of pre-bundle" errors
5855
- // during first startup when node_modules/.vite cache is empty.
5856
- // These are discovered dynamically by the virtual modules, so we need to
5857
- // tell Vite about them ahead of time.
5858
- include: [
5859
- "openai",
5860
- "zod",
5861
- "@standardagents/builder/runtime",
5862
- "@standardagents/builder/built-in-routes"
5863
- ],
5864
- // Exclude MCP as it's not used in the main app
5865
- exclude: [
5866
- "@standardagents/builder/mcp"
5867
- ]
5860
+ // Exclude our packages from pre-bundling - they contain cloudflare:workers imports
5861
+ // that cannot be resolved during dependency optimization
5862
+ exclude: depsToExclude
5868
5863
  },
5869
5864
  ssr: {
5870
- // Mark as external for SSR/worker builds to prevent bundling
5871
- // Note: @standardagents/builder, @standardagents/builder/runtime, built-in-routes, and rou3
5872
- // are NOT external - they must be bundled into the worker for Cloudflare Workers runtime
5873
- external: [
5874
- "@standardagents/builder/mcp"
5865
+ // Only MCP should be external (not used in worker)
5866
+ external: ["@standardagents/builder/mcp"],
5867
+ // noExternal ensures Vite transforms these instead of leaving as external
5868
+ // The Cloudflare plugin handles the actual bundling and knows about cloudflare:workers
5869
+ noExternal: [
5870
+ "@standardagents/builder",
5871
+ "@standardagents/builder/runtime",
5872
+ "@standardagents/builder/built-in-routes"
5875
5873
  ]
5876
5874
  },
5877
5875
  build: {
5878
5876
  rollupOptions: {
5879
- // Also mark as external for Rollup/build (used by Cloudflare Workers plugin)
5880
- // Note: @standardagents/builder, @standardagents/builder/runtime, built-in-routes, and rou3
5881
- // are NOT external - they must be bundled into the worker for Cloudflare Workers runtime
5882
- external: [
5883
- "@standardagents/builder/mcp"
5884
- ]
5877
+ external: ["@standardagents/builder/mcp"]
5885
5878
  }
5886
5879
  }
5887
5880
  };
5888
5881
  },
5882
+ // Apply exclusions to ALL environments including Cloudflare worker
5883
+ configEnvironment(name, config) {
5884
+ const depsToExclude = [
5885
+ "@standardagents/builder",
5886
+ "@standardagents/builder/runtime",
5887
+ "@standardagents/builder/built-in-routes",
5888
+ "@standardagents/builder/mcp"
5889
+ ];
5890
+ config.optimizeDeps = config.optimizeDeps || {};
5891
+ config.optimizeDeps.exclude = [
5892
+ ...config.optimizeDeps.exclude || [],
5893
+ ...depsToExclude.filter((dep) => !config.optimizeDeps?.exclude?.includes(dep))
5894
+ ];
5895
+ },
5889
5896
  resolveId(id) {
5890
5897
  if (id === VIRTUAL_TOOLS_ID) {
5891
5898
  return RESOLVED_VIRTUAL_TOOLS_ID;