Skip to content

--cross-origin build option not respected by lazy loader #22942

@jjamid

Description

@jjamid

🐞 Bug report

Command (mark with an x)

  • new
  • [x ] build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • [] run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 12

Description

In Android WebView, the default behavior for type="module" is not to send credentials, even for same origin.
Using the build option --cross-origin=use-credentials solves this problem for the initial scripts by
adding it to the generated scripts.

ng build --configuration=production --cross-origin=use-credentials

However, the lazy loader does not respect this option and only checks the window.location.origin and doesn't add crossOrigin="use-credentials" to the lazy load requests for the same origin.
As a result the module loading fails.

One expects that it will respect the build option --cross-origin=use-credentials

As a work around, I manually change the runtime.js file after build to add the crossOrigin attribute.

🔬 Minimal Reproduction

Running an angular 13 application with lazy loading in an android WebView when cookies are needed for same origin.

🔥 Exception or Error





🌍 Your Environment





Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions