Skip to content

Can't compile on React components on production with Vite but works on development #28640

@alexandresebrao

Description

@alexandresebrao

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

webpack builder

Description

I can use react components okay with vite with ng serve, but it won't build

My org is a multi front-end team, and some teams work with react, others with angular, and is a big system, we can't migrate all react to angular.

During serve everything works flawlessly but during build it fails on compile time

Minimal Reproduction

[Create a new angular project with ssr

Add react, react dom ](https://github.com/alexandresebrao/ssr-19-angular-react)

This is a minimal repro.

Exception or Error

✘ [ERROR] Expected ")" but found "Component"

src/app/react.tsx:6:16:
  6 │       <h1>React Component</h1>
    │                 ~~~~~~~~~
    ╵                 )

Your Environment

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | |
/ ___ | | | | (
| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/

Angular CLI: 19.0.0-next.9
Node: 20.17.0
Package Manager: npm 10.9.0
OS: linux x64

Angular: 19.0.0-next.8
... animations, common, core, forms, platform-browser
... platform-browser-dynamic, platform-server, router

Package Version

@angular-devkit/architect 0.1900.0-next.9
@angular-devkit/build-angular 19.0.0-next.9
@angular-devkit/core 19.0.0-next.9
@angular-devkit/schematics 19.0.0-next.9
@angular/cli 19.0.0-next.9
@angular/compiler 19.0.0-next.9
@angular/compiler-cli 19.0.0-next.9
@angular/ssr 19.0.0-next.9
@schematics/angular 19.0.0-next.9
rxjs 7.8.1
typescript 5.6.2
zone.js 0.15.0

Anything else relevant?

I think if it doesn't have a problem during serve, it should work okay with build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions