Repository navigation
Get build passing for AOT example - #578
Conversation
| import { HammerGesturesPlugin } from '@angular/platform-browser/src/dom/events/hammer_gestures'; | ||
| import { DomRootRenderer } from '@angular/platform-browser/src/dom/dom_renderer'; | ||
| import { SharedStylesHost, DomSharedStylesHost } from '@angular/platform-browser/src/dom/shared_styles_host'; | ||
| import { DomSanitizerImpl } from '@angular/platform-browser/src/security/dom_sanitization_service'; |
There was a problem hiding this comment.
@alexeagle we're running into this issue again 😞
One finding that seems relevant - in node-http.ts we export a function called __noop. When transpiled with ngc, ngc omits the function from the transpiled result. Renaming the function to _noop (i.e. one underscore prefix instead of two) the transpiled result preserves the exported function
There seems to be a strange handling in ngc of two underscore prefixed export names. It seems that this could be related
"stripInternal" is off throughout this project now (I even tried explicitly setting it to false in our tsconfig files and that didn't change anything), but we're still getting this problem
Would you happen to have any idea a way we can resolve this and get back to using private imports properly like we were?
There was a problem hiding this comment.
stripInternal is only related to @internal, not to underscore prefix.
I don't know what "this issue" means, is there an issue filed?
There was a problem hiding this comment.
Sorry, the issue is when we import from __private_imports__ (which is a set of exports that are imported from private exports from angular, e.g. __platform_browser_private__ from @angular/platform-browser), when we compile with ngc the generated .d.ts file are missing type information for anything from those private exports
The code above replaces the commented code below, which we need to be using instead vs direct module path exports above
Before, your suggestion to set skipInternal to false fixed the @internal tags not being transpiled, but also fixed the __private_imports__ as well, so it seemed related
Now, for some reason though, we are seeing the issue again. And the __noop vs _noop example also showed the same result, i.e. if noop was prefixed with two underscores, it seems to be treated by ngc as being @internal, but removing one of the underscores leaves it treated as any other export again and emits properly
Let me know if I can clarify this better, it's certainly an odd issue that I've yet to fully wrap my head around so can be a little tough to describe well
|
Also note that because this PR uses direct module paths the server won't run as the files at the full paths use ES modules which the server will throw on "unexpected token import" at runtime, so far us to be able to move on we need to resolve the issue of ngc not properly emitting .d.ts information for double underscore prefixed variables or find another workaround |
|
What happens in @angular/platform-browser? It has the same imports from On Thu, Oct 6, 2016 at 11:50 AM Steve Sewell notifications@github.com
|
|
@alexeagle just made this branch to help easily reproduce the issues It is the same as @gdi2290's branch but with the other build fixes so that as soon as the to reproduce you'll want to You should see typescript complaining that everything from Interestingly, you will see that you will get the same issue if you, for example, rename Hope that helps, and thank you for your help! |
|
@alexeagle in case it helps, after a little more testing, it looks like with either So even when using export { BROWSER_SANITIZATION_PROVIDERS, SharedStylesHost, DomSharedStylesHost, DomRootRenderer, DomEventsPlugin, DomAdapter, setRootDomAdapter, KeyEventsPlugin, HammerGesturesPlugin, SelectorMatcher, CssSelector, ViewUtils, AnimationKeyframe, AnimationPlayer, AnimationStyles, RenderDebugInfo };
declare var __empty: any;
export default __empty;Note it strips all of the imports of what is being exported ( The original typescript file for import { __platform_browser_private__ } from '@angular/platform-browser';
import { __core_private__ } from '@angular/core';
import { __compiler_private__ } from '@angular/compiler';
// PRIVATE
const {
BROWSER_SANITIZATION_PROVIDERS,
SharedStylesHost,
DomSharedStylesHost,
DomRootRenderer,
DomEventsPlugin,
KeyEventsPlugin,
DomAdapter,
setRootDomAdapter,
HammerGesturesPlugin
} = __platform_browser_private__;
const {
ViewUtils,
AnimationKeyframe,
AnimationPlayer,
AnimationStyles,
RenderDebugInfo
} = __core_private__;
const {
SelectorMatcher,
CssSelector
} = __compiler_private__;
// @internal
export {
// platform-browser
BROWSER_SANITIZATION_PROVIDERS,
SharedStylesHost,
DomSharedStylesHost,
DomRootRenderer,
DomEventsPlugin,
DomAdapter,
setRootDomAdapter,
KeyEventsPlugin,
HammerGesturesPlugin,
// compiler
SelectorMatcher,
CssSelector,
// core
ViewUtils,
AnimationKeyframe,
AnimationPlayer,
AnimationStyles,
RenderDebugInfo,
}
var __empty = null;
export default __empty;Perhaps it is just written into typescript to not emit exports or imports with a |
|
cc @gdi2290 |
|
@alexeagle @gdi2290 I pushed another commit here that works around the interfaces not found issue by using the private exports object directly without destructuring Unfortunately, this causes this issue to happen. I believe this is a bug in the compiler CLI (if interested, see comments on issue for detail). I've run into it before and always use the same workaround Manually updating the angular/compiler-cli code (gross, I know) with the sample I note in the github issue allows the build to work end to end. Even if we don't want to use these updates as-is, at least hopefully this information is useful by demonstrating a workaround to the |
ac7ff31 to
8b49354
Compare
85fead2 to
f932975
Compare
|
(also note the reason the build fails is for the same issue my PR to I've also manually verified through linking that with my updates to angular the build passes as expected |
|
@steve8708 thanks, merged to my PR |
|
@gdi2290 👍 note there is one more issue I've found. If you manually updated node_modules/@angular/compiler with a similar change as my PR to allow the build will pass but you'll get runtime errors that providers cannot be found (e.g. DomRootRenderer) Taking a look at that now but it is a strange one that is a little tricky to try and poke into why exactly that happens only in AOT mode and not in JIT mode |
|
I had similar problem with providers not found. The issue was the ngfactory On Mon, Oct 10, 2016 at 12:09 PM Steve Sewell notifications@github.com
|
|
Ah... this is very helpful, thank you @alexeagle! I'll dig in deeper and see if I can verify. Poking around the compiled ngfactory code could possibly help, will try that first |
|
Maybe it's not direct related to this issue, but since I got here: |
|
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. |
(this PR points to the
update-angular-2-0-1branch)