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

AOT + JIT at once #20156

Closed
p3x-robot opened this issue Nov 3, 2017 · 9 comments
Closed

AOT + JIT at once #20156

p3x-robot opened this issue Nov 3, 2017 · 9 comments

Comments

@p3x-robot
Copy link

@p3x-robot p3x-robot commented Nov 3, 2017

I'm submitting a...


[x] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[x] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Angular 5 doesn't allow to build a system with AOT + JIT at once.

Expected behavior

Have a system that can use AOT + JIT at once. I was working on it for 2 weeks to make it work. Now you are saying it is impossible. Why?

Minimal reproduction of the problem with instructions

https://pages.corifeus.com/github/corifeus

Angular 4.4.6

git clone https://github.com/patrikx3/corifeus-app-web-pages
yarn install
grunt clean copy:cory-build cory-compile-angular webpack:cory-build-aot-jit test-connect

Got to http://localhost:9000

It is a AOT web page, but the readme.md and all .md files are generated with JIT.

What is the motivation / use case for changing the behavior?

Environment


Angular version: X.Y.Z


Browser:
- [x] Chrome (desktop) version XX
- [x] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version XX
- [x] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [] IE version XX
- [x] Edge version XX
 
For Tooling issues:
- Node version: 9.0.0 
- Platform:  Linux workstation 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux 

Others:

So how can I do it now with Angular 5?

@mlc-mlapis
Copy link
Contributor

@mlc-mlapis mlc-mlapis commented Nov 3, 2017

... because JIT compilation is still working in browsers there should be certainly a way how to do it. At least when you dynamically load a module (not AOT compiled) with components that contain HTML templates (even with children components, ...) ... these templates are compiled as needed in runtime ... so something has been changed ... it is sure but I don't think that it is an unsolvable problem ... just a right doc is missing at this moment.

On the other hand this type of case wasn't certainly a priority for initial releasing of R5 ... take that it was never officially documented at all.

@vicb vicb added the comp: core label Nov 3, 2017
@vicb
Copy link
Contributor

@vicb vicb commented Nov 3, 2017

To reduce the payload we do not ship the compiler in AoT

@vicb vicb closed this Nov 3, 2017
@p3x-robot
Copy link
Author

@p3x-robot p3x-robot commented Apr 24, 2018

it is true though, because the AOT is already bigger, though the size is not important, because we can use GZIP, but i got it, though functional it is a question

@spencerfontein
Copy link

@spencerfontein spencerfontein commented Mar 1, 2019

@p3x-robot what is the status on this? Are you saying there is no work around but using JIT can be just as fast and as small as AOT?

@spencerfontein
Copy link

@spencerfontein spencerfontein commented Mar 1, 2019

@mlc-mlapis
Copy link
Contributor

@mlc-mlapis mlc-mlapis commented Mar 1, 2019

@spencerfontein ... you can load JitCompiler into AOT app on your own ... there several issues which explain how to do it. It starts with imports:

import { COMPILER_OPTIONS, CompilerFactory, Compiler } from '@angular/core';
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';
@p3x-robot
Copy link
Author

@p3x-robot p3x-robot commented Mar 1, 2019

you can solve it with angular 4 aot + jit, since angular 5 either aot or jit, no other option, but jit is not much slower, besides jit produces smaller bundle, while aot has bigger bundle so when you load it is almost the same time. they say aot is smaller but it is not true.

@p3x-robot
Copy link
Author

@p3x-robot p3x-robot commented Mar 7, 2019

@spencerfontein of course, there are some hacks, but by now i use either AOT only, or if i just need dynamic i use JIT only, the simplest... you might not need all that complex logic...

@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Sep 14, 2019

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants