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

JIT compilation filed when bootstrapping. #21

Open
patrick99e99 opened this issue Sep 1, 2022 · 0 comments
Open

JIT compilation filed when bootstrapping. #21

patrick99e99 opened this issue Sep 1, 2022 · 0 comments

Comments

@patrick99e99
Copy link

With angular 14, if I try to
platformBrowserDynamic().bootstrapModule(AppModule);

I get:

core.mjs:4103 JIT compilation failed for injectable class PlatformLocation {
historyGo(relativePosition) {
throw new Error('Not implemented');
}
}
getCompilerFacade @ core.mjs:4103
ɵɵngDeclareFactory @ core.mjs:29571
./node_modules/@angular/common/fesm2020/common.mjs @ common.mjs:90
webpack_require @ bootstrap:19
./node_modules/@angular/platform-browser/fesm2020/platform-browser.mjs @ vendors-node_modules_angular_platform-browser_fesm2020_platform-browser_mjs.js:52
webpack_require @ bootstrap:19
./app/javascript/packs/application.ts @ app.service.ts:6
webpack_require @ bootstrap:19
webpack_exec @ application.ts:5
(anonymous) @ application.ts:5
webpack_require.O @ chunk loaded:23
(anonymous) @ application.ts:5
webpackJsonpCallback @ jsonp chunk loading:34
(anonymous) @ application.js:2
core.mjs:4122 Uncaught Error: The injectable 'PlatformLocation' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.

The injectable is part of a library that has been partially compiled.
However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.

Ideally, the library is processed using the Angular Linker to become fully AOT compiled.
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 getCompilerFacade (core.mjs:4122:1)
at Module.ɵɵngDeclareFactory (core.mjs:29571:1)
at ./node_modules/@angular/common/fesm2020/common.mjs (common.mjs:90:1)
at webpack_require (bootstrap:19:1)
at ./node_modules/@angular/platform-browser/fesm2020/platform-browser.mjs (vendors-node_modules_angular_platform-browser_fesm2020_platform-browser_mjs.js:52:73)
at webpack_require (bootstrap:19:1)
at ./app/javascript/packs/application.ts (app.service.ts:6:1)
at webpack_require (bootstrap:19:1)
at webpack_exec (application.ts:5:1)
at application.ts:5:1
getCompilerFacade @ core.mjs:4122
ɵɵngDeclareFactory @ core.mjs:29571
./node_modules/@angular/common/fesm2020/common.mjs @ common.mjs:90
webpack_require @ bootstrap:19
./node_modules/@angular/platform-browser/fesm2020/platform-browser.mjs @ vendors-node_modules_angular_platform-browser_fesm2020_platform-browser_mjs.js:52
webpack_require @ bootstrap:19
./app/javascript/packs/application.ts @ app.service.ts:6
webpack_require @ bootstrap:19
webpack_exec @ application.ts:5
(anonymous) @ application.ts:5
webpack_require.O @ chunk loaded:23
(anonymous) @ application.ts:5
webpackJsonpCallback @ jsonp chunk loading:34
(anonymous) @ application.js:2
localhost/:1 Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.

I have to manually add import { '@angular/compiler' } but my understanding is doing that significantly adds to my build size... I tried using PlatformBrowser() instead but that resulted in the same error unless I import the compiler...

My configuration is pretty much identical to yours otherwise, so I am not sure if maybe this is different in 14 vs 12?

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

No branches or pull requests

1 participant