@standardagents/builder 0.9.8 → 0.9.10

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
@@ -2051,71 +2051,46 @@ function agentbuilder(options = {}) {
2051
2051
  }
2052
2052
  return {
2053
2053
  name: "vite-plugin-agent",
2054
- config(config) {
2055
- const depsToInclude = [
2056
- "openai",
2057
- "zod",
2058
- "@standardagents/builder/runtime",
2059
- "@standardagents/builder/built-in-routes"
2060
- ];
2054
+ config() {
2061
2055
  const depsToExclude = [
2056
+ "@standardagents/builder",
2057
+ "@standardagents/builder/runtime",
2058
+ "@standardagents/builder/built-in-routes",
2062
2059
  "@standardagents/builder/mcp"
2063
2060
  ];
2064
- const environments = {};
2065
- if (config.environments) {
2066
- for (const envName of Object.keys(config.environments)) {
2067
- environments[envName] = {
2068
- optimizeDeps: {
2069
- include: depsToInclude,
2070
- exclude: depsToExclude
2071
- }
2072
- };
2073
- }
2074
- }
2075
2061
  return {
2076
- // Root optimizeDeps for client environment
2077
2062
  optimizeDeps: {
2078
- // Pre-bundle these deps upfront to prevent "new version of pre-bundle" errors
2079
- // during first startup when node_modules/.vite cache is empty.
2080
- // These are discovered dynamically by the virtual modules, so we need to
2081
- // tell Vite about them ahead of time.
2082
- include: depsToInclude,
2063
+ // Exclude our packages from pre-bundling - they contain cloudflare:workers imports
2064
+ // that cannot be resolved during dependency optimization
2083
2065
  exclude: depsToExclude
2084
2066
  },
2085
- // Also configure for environments (Cloudflare worker uses a custom environment)
2086
- environments,
2087
2067
  ssr: {
2088
- // Mark as external for SSR/worker builds to prevent bundling
2089
- // Note: @standardagents/builder, @standardagents/builder/runtime, built-in-routes, and rou3
2090
- // are NOT external - they must be bundled into the worker for Cloudflare Workers runtime
2091
- external: depsToExclude
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"
2076
+ ]
2092
2077
  },
2093
2078
  build: {
2094
2079
  rollupOptions: {
2095
- // Also mark as external for Rollup/build (used by Cloudflare Workers plugin)
2096
- // Note: @standardagents/builder, @standardagents/builder/runtime, built-in-routes, and rou3
2097
- // are NOT external - they must be bundled into the worker for Cloudflare Workers runtime
2098
- external: depsToExclude
2080
+ external: ["@standardagents/builder/mcp"]
2099
2081
  }
2100
2082
  }
2101
2083
  };
2102
2084
  },
2103
- // Use configEnvironment hook to set optimizeDeps for each environment including worker
2085
+ // Apply exclusions to ALL environments including Cloudflare worker
2104
2086
  configEnvironment(name, config) {
2105
- const depsToInclude = [
2106
- "openai",
2107
- "zod",
2108
- "@standardagents/builder/runtime",
2109
- "@standardagents/builder/built-in-routes"
2110
- ];
2111
2087
  const depsToExclude = [
2088
+ "@standardagents/builder",
2089
+ "@standardagents/builder/runtime",
2090
+ "@standardagents/builder/built-in-routes",
2112
2091
  "@standardagents/builder/mcp"
2113
2092
  ];
2114
2093
  config.optimizeDeps = config.optimizeDeps || {};
2115
- config.optimizeDeps.include = [
2116
- ...config.optimizeDeps.include || [],
2117
- ...depsToInclude.filter((dep) => !config.optimizeDeps?.include?.includes(dep))
2118
- ];
2119
2094
  config.optimizeDeps.exclude = [
2120
2095
  ...config.optimizeDeps.exclude || [],
2121
2096
  ...depsToExclude.filter((dep) => !config.optimizeDeps?.exclude?.includes(dep))