@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/plugin.js CHANGED
@@ -2052,43 +2052,50 @@ function agentbuilder(options = {}) {
2052
2052
  return {
2053
2053
  name: "vite-plugin-agent",
2054
2054
  config() {
2055
+ const depsToExclude = [
2056
+ "@standardagents/builder",
2057
+ "@standardagents/builder/runtime",
2058
+ "@standardagents/builder/built-in-routes",
2059
+ "@standardagents/builder/mcp"
2060
+ ];
2055
2061
  return {
2056
2062
  optimizeDeps: {
2057
- // Pre-bundle these deps upfront to prevent "new version of pre-bundle" errors
2058
- // during first startup when node_modules/.vite cache is empty.
2059
- // These are discovered dynamically by the virtual modules, so we need to
2060
- // tell Vite about them ahead of time.
2061
- include: [
2062
- "openai",
2063
- "zod",
2064
- "@standardagents/builder/runtime",
2065
- "@standardagents/builder/built-in-routes"
2066
- ],
2067
- // Exclude MCP as it's not used in the main app
2068
- exclude: [
2069
- "@standardagents/builder/mcp"
2070
- ]
2063
+ // Exclude our packages from pre-bundling - they contain cloudflare:workers imports
2064
+ // that cannot be resolved during dependency optimization
2065
+ exclude: depsToExclude
2071
2066
  },
2072
2067
  ssr: {
2073
- // Mark as external for SSR/worker builds to prevent bundling
2074
- // Note: @standardagents/builder, @standardagents/builder/runtime, built-in-routes, and rou3
2075
- // are NOT external - they must be bundled into the worker for Cloudflare Workers runtime
2076
- external: [
2077
- "@standardagents/builder/mcp"
2068
+ // Only MCP should be external (not used in worker)
2069
+ external: ["@standardagents/builder/mcp"],
2070
+ // noExternal ensures Vite transforms these instead of leaving as external
2071
+ // The Cloudflare plugin handles the actual bundling and knows about cloudflare:workers
2072
+ noExternal: [
2073
+ "@standardagents/builder",
2074
+ "@standardagents/builder/runtime",
2075
+ "@standardagents/builder/built-in-routes"
2078
2076
  ]
2079
2077
  },
2080
2078
  build: {
2081
2079
  rollupOptions: {
2082
- // Also mark as external for Rollup/build (used by Cloudflare Workers plugin)
2083
- // Note: @standardagents/builder, @standardagents/builder/runtime, built-in-routes, and rou3
2084
- // are NOT external - they must be bundled into the worker for Cloudflare Workers runtime
2085
- external: [
2086
- "@standardagents/builder/mcp"
2087
- ]
2080
+ external: ["@standardagents/builder/mcp"]
2088
2081
  }
2089
2082
  }
2090
2083
  };
2091
2084
  },
2085
+ // Apply exclusions to ALL environments including Cloudflare worker
2086
+ configEnvironment(name, config) {
2087
+ const depsToExclude = [
2088
+ "@standardagents/builder",
2089
+ "@standardagents/builder/runtime",
2090
+ "@standardagents/builder/built-in-routes",
2091
+ "@standardagents/builder/mcp"
2092
+ ];
2093
+ config.optimizeDeps = config.optimizeDeps || {};
2094
+ config.optimizeDeps.exclude = [
2095
+ ...config.optimizeDeps.exclude || [],
2096
+ ...depsToExclude.filter((dep) => !config.optimizeDeps?.exclude?.includes(dep))
2097
+ ];
2098
+ },
2092
2099
  resolveId(id) {
2093
2100
  if (id === VIRTUAL_TOOLS_ID) {
2094
2101
  return RESOLVED_VIRTUAL_TOOLS_ID;