Skip to content

🐛 BUG: Wrangler + Angular SSR (prerender: false) + Private properties = TypeError: Class constructor t cannot be invoked without 'new' #5263

@nunoarruda

Description

@nunoarruda

Which Cloudflare product(s) does this pertain to?

Pages

What version(s) of the tool(s) are you using?

2.14.2 [create-cloudflare]

What version of Node are you using?

20.11.1

What operating system and version are you using?

macOS Sonoma 14.4

Describe the Bug

Observed behavior

I noticed that:

  1. When using the command npm create cloudflare@latest my-angular-app -- --framework=angular, an Angular SSR app is created with additional files and changes to make it work with Cloudflare Workers/Pages.
  2. Static Site Generation (SSG) is enabled by default ("prerender": true on angular.json)
  3. If you turn off SSG ("prerender": false), so everything is Server Side Rendered (SSR), and add a private property, things break.

Expected behavior

SSR should just work and not break with private properties.

Steps to reproduce

  1. Create a Cloudflare version of an Angular app npm create cloudflare@latest my-angular-app -- --framework=angular
  2. Turn off Static Site Generation (SSG) by setting "prerender": false on angular.json
  3. Add a private property (like, for example, #test = 'test')
  4. Run the app: npm run start and press b

cc: @petebacondarwin @alan-agius4 @JeanMeche

Please provide a link to a minimal reproduction

https://github.com/nunoarruda/my-angular-app

Please provide any relevant error logs

[wrangler:err] TypeError: Class constructor t cannot be invoked without 'new'
    at t.handleNavigationRequest (file:///Users/nunoarruda/Desktop/my-angular-app/.wrangler/tmp/pages-3oJJr3/chunk-ZK4POREG.mjs:2:47542)
    at t.scheduleNavigation (file:///Users/nunoarruda/Desktop/my-angular-app/.wrangler/tmp/pages-3oJJr3/chunk-ZK4POREG.mjs:2:63103)
    at t.navigateToSyncWithBrowser (file:///Users/nunoarruda/Desktop/my-angular-app/.wrangler/tmp/pages-3oJJr3/chunk-ZK4POREG.mjs:2:61042)
    at t.initialNavigation (file:///Users/nunoarruda/Desktop/my-angular-app/.wrangler/tmp/pages-3oJJr3/chunk-ZK4POREG.mjs:2:60522)
    at s (file:///Users/nunoarruda/Desktop/my-angular-app/.wrangler/tmp/pages-3oJJr3/chunk-ZK4POREG.mjs:2:64001)
    at null.<anonymous> (file:///Users/nunoarruda/Desktop/my-angular-app/.wrangler/tmp/pages-3oJJr3/chunk-ES3Z552B.mjs:34:29056)
    at [object Object]
    at e._loadComponent (file:///Users/nunoarruda/Desktop/my-angular-app/.wrangler/tmp/pages-3oJJr3/chunk-ES3Z552B.mjs:34:29045)
    at e.bootstrap (file:///Users/nunoarruda/Desktop/my-angular-app/.wrangler/tmp/pages-3oJJr3/chunk-ES3Z552B.mjs:34:28076)
    at null.<anonymous> (file:///Users/nunoarruda/Desktop/my-angular-app/.wrangler/tmp/pages-3oJJr3/chunk-ES3Z552B.mjs:34:35938)
[wrangler:inf] GET / 500 Internal Server Error
Screenshot 2024-03-15 at 16 00 36

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions