Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rsbuild] Runtime error JIT compilation failed for component class AppComponent (Angular CLI project) #75

Open
edbzn opened this issue Jan 23, 2025 · 1 comment · May be fixed by #77
Open

Comments

@edbzn
Copy link
Contributor

edbzn commented Jan 23, 2025

When generating a fresh CSR app with the Angular CLI with the following rsbuild config:

import { createConfig } from '@ng-rsbuild/plugin-angular';

export default createConfig({
  browser: './src/main.ts',
});

and running npx rspack dev results in the following runtime error in the browser:

JIT compilation failed for component class AppComponent {
    constructor(){
        (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_2__._)(this, "title", 'test-rspack');
    }
}
main.ts:5 Error: The component 'AppComponent' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.

JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.
Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.
    at ./src/main.ts (main.ts:5:1)
    at __webpack_require__ (main.ts:5:1)
    at main.ts:5:1

Note that this issue seems to only happen in Angular CLI projects.

edbzn added a commit to edbzn/ng-rspack-build that referenced this issue Jan 23, 2025
edbzn added a commit to edbzn/ng-rspack-build that referenced this issue Jan 23, 2025
edbzn added a commit to edbzn/ng-rspack-build that referenced this issue Jan 24, 2025
@sefatanam
Copy link

I started with fresh CSR angular application and encounter the same issue today.
Here is my package details.


Angular CLI: 19.1.4
Node: 20.18.1
Package Manager: pnpm 9.14.2
OS: darwin arm64

Angular: 19.1.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1901.4
@angular-devkit/build-angular   19.1.4
@angular-devkit/core            19.1.4
@angular-devkit/schematics      19.1.4
@angular/cli                    19.1.4
@schematics/angular             19.1.4
rxjs                            7.8.1
typescript                      5.7.3
zone.js                         0.15.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants