[wrangler] fix: Angular auto-config treats non-SSR projects as assets-only SPA deployments#13039
Conversation
…-only SPA deployments
🦋 Changeset detectedLatest commit: 126f560 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
|
✅ All changesets look good |
|
Let me think through the changes carefully:
The changes are clean, the fix is correct, the tests are thorough, and I don't see any logic bugs, security issues, or backward compatibility problems. The SSR path behavior is preserved exactly as before, and the new SPA path is a reasonable assets-only configuration. LGTM |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Looks good to me! Thanks Pete 😄
packages/wrangler/src/__tests__/autoconfig/frameworks/angular.test.ts
Outdated
Show resolved
Hide resolved
packages/wrangler/src/__tests__/autoconfig/frameworks/angular.test.ts
Outdated
Show resolved
Hide resolved
…-only SPA deployments (cloudflare#13039)
Fixes #12950.
When
wrangler deploy(orwrangler setup) is run against a plain Angular SPA — created withng newwithout the--ssrflag — the auto-config code was unconditionally trying to setarchitect.build.options.ssr.experimentalPlatform = "neutral"inangular.json. Sincessrdoesn't exist in a non-SSR project'sangular.json, this threw:Changes
packages/wrangler/src/autoconfig/frameworks/angular.tshasSsr()helper that checks whetherarchitect.build.options.ssrexists and is truthy inangular.jsonconfigure()now readsangular.jsonupfront and branches on SSR detection:configurationDescription = "Configuring Angular SPA project (assets only)", returns an assets-onlywranglerConfig(nomainentry), and skipsupdateAngularJson,overrideServerFile, andinstallAdditionalDependenciesconfigurationDescription = "Configuring project for Angular"and keeps all existing behaviour unchangedAngularJsontype to makessroptional (ssr?: Record<string, unknown> | false | null)updateAngularJsonnow receives the already-parsedangularJsonas a parameter to avoid reading the file twicepackages/wrangler/src/__tests__/autoconfig/frameworks/angular.test.ts(new)14 unit tests covering:
ssrfield): assets-only config returned, no side effects triggeredssr: falseproject: treated the same as non-SSRangular.jsonupdated,src/server.tscreated,xhr2installed;dryRunskips all side effectsA picture of a cute animal (not mandatory, but encouraged)