-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Could/would/will code using COMPILER_PROVIDERS be supported by AOT? #11780
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
Comments
+1 |
In AOT there is no need for compiler (as templates have already been compiler) which explains why you can not include it. |
Unless you're developing a library which creates components dynamically - as we are. Our users want to be able to use AoT compiling on their projects, but we're unable to compile ours first (and generate the necessary metadata files) due to the above issue |
Well, the application could be pretty large, robust at the end....and there could be up to 99% of components static ready for AOT. And only few could use So, @vicb are you saying that we cannot pre-compile that application at all? Just because of these few components, which really will be re/compiled at runtime. If the answer is all or nothing... I doubt I'd think it is a design decision I would support, vote for Is there some workaround at least? I tried to move these providers among modules.. but if they are loaded to |
I get this issue on node 6.7.0 but not on 4.7.0 |
See also the first paragraph after the modules list in https://github.com/angular/angular/blob/f5b0e22d352fd00cee1dc9016e85bdef94256e62/docs/PUBLIC_API.md |
Hello, Is there any workaround ou a another method to use COMPILER_PROVIDERS with AOT? |
For me, when importing Besides, without this import, using only The error I have :
Ionic version : 2.0.0-rc1Any idea of what to do? |
Don't use runtime compiler and aot. |
@DzmitryShylovich do you have an idea of how to answer the need in an other way? The need being : to be able to dynamically create a component based on runtime configuration? |
then the only answer is jit |
Okay, so if I want to build a component just on time, what I have to do? I am not really experienced about that... |
You should use ComponentFactoryResolver http://plnkr.co/edit/kkM1aR4yPcIqeBhamoDW?p=preview |
Okay, it is interesting, thank you for sharing. After looking at API reference, I am now wondering how I could give arguments for configuring the component like template. Maybe you know what I have to do and/or where I have to go to deal with it in depth? |
I found this article of @laco0416 that seems to answer the need. |
Finally, I am hardly following @Radim-Kohler and hope that we will be able to use COMPILER_PROVIDERS with AoT (maybe with some additionnable configuration, being aware of the drawbacks). |
+1 |
+1 |
@hadrien-toma See here for a solution that bypasses the use of |
Just in case it helps anyone, the following still works for me in an Angular 2.4.4 project using Angular CLI 1.0.0-beta.26 and https://github.com/laco0416/angular2-component-outlet 3.0.1 (I know, we should migrate to ng-dynamic). In
In
I'll admit I'm not 100% sure what I'm doing here. But this works just fine for Without the above, |
@avbentem does solve the issue, however, it adds 1.21MB to the vendor bundle. One of the reasons of course to use AoT is to having to avoid to include a compiler. Is there any way to at least only include the compiler on a module level, so the added size is in a chunk instead of the vendor? |
Especially with Angular CLI being all AOT please seriously reconsider adding a feature that allows creating truly dynamic components at runtime! |
@DzmitryShylovich Thanks, but I knew this article before. I was also able to use the JitCompiler before. |
Same error here, I cannot use dynamic compiler. |
@DzmitryShylovich thanks for all the effort, but all your references are pointing to examples where the component and the template html are statically available. Correct me if I'm worng but I haven't found any solution to this problem concerning AOT |
a tried jit, but aot is broken together. looks like aot and jit together not working, |
I think there would be value in mixing JIT and AoT - if it was possible. We have an application similar to some of the commenters above, where 90% is statically known and could be compiled ahead of time to gain the start-up time benefits. But then there are individual sections that are dynamically compiled. We can't mix the two right now. |
I get this error: Have to wait for it. |
I haven't tested it, but there is a proposed solution here that seems to have worked for at least two people |
Is there any plan to support this? I am also facing same issue in Angular 8. I have only one page which needs dynamic component. I can't use aot because of this error. |
I'm trying to do the same thing, except I'm on Angular 7 still. Looks like there is an option of using "import()" if you upgrade to Angular 8. Have you tried this? https://blog.angularindepth.com/automatically-upgrade-lazy-loaded-angular-modules-for-ivy-e760872e6084 |
I'm going to close this as a duplicate of #15510, which has a lot of other discussion on the topic. The tl;dr is that this wasn't ever a design goal of Angular View Engine, but it was in Angular Ivy, and so in Ivy you can happily write an AOT app that loads the JIT compiler (even lazy-loads it!) to compile and render a few dynamic components. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When I run a command
I get the error:
That all is related to this piece of code
Once COMPILER_PROVIDERS are not declared
then AOT works as expected... just ... as also expected, the app is not working (simply, COMPILER_PROVIDERS are needed for it)
I did see this "encouraging disclaimer"
So - it is experimental, private, "I cannot rely on it" ... but I need it.
Please, am I doing something wrong? or is intended ... COMPILER_PROVIDERS will never be supported by AOT?
The text was updated successfully, but these errors were encountered: