@ngtools/webpack - aot error when compiling a library containing component
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [ x ] bug report -> please search issues before submitting
- [ ] feature request
Versions.
- Node 8.2.1
- NPM 5.3.0
- Windows 10
- ngtools/webpack: 1.5.5
Repro steps.
git clone https://github.com/stephenlautier/aot-comp-error.git
npm i
npm run build:rel
Sample repo https://github.com/stephenlautier/aot-comp-error
Note: This is pretty much a project created with dotnet new angular
+ added material
The log given by the failure.
ERROR in ./$$_gendir/~/@odin/ngx.core/dist/xyz.component.ngfactory.ts
Module parse failed: C:\dev\git\loki\$$_gendir\node_modules\@odin\ngx.core\dist\xyz.component.ngfactory.ts Unexpected token (11:25)
You may need an appropriate loader to handle this file type.
| import * as i0 from '@angular/core';
| import * as i1 from '@odin/ngx.core/dist/xyz.component';
| const styles_XyzComponent:any[] = ([] as any[]);
| export const RenderType_XyzComponent:i0.RendererType2 = i0.ɵcrt({encapsulation:2,styles:styles_XyzComponent,
| data:{}});
@ ./$$_gendir/ClientApp/app/areas/home/home.component.ngfactory.ts 9:0-104
@ ./$$_gendir/ClientApp/app/app.module.browser.ngfactory.ts
@ ./ClientApp/boot-browser.ts
Desired functionality.
Build app with AoT when having a library which contains components.
Mention any other details that might be useful.
I’m using the JavaScriptServices for .netcore (also created an issue there https://github.com/aspnet/JavaScriptServices/issues/1168). When I’m adding a library such as Angular Material, or even I created a simple component within a library to narrow this down, and building the app as AoT, we get the above error.
The following is a simple component which doesn’t work
import { Component } from "@angular/core";
@Component({
selector: "odn-xyz",
template: `<h1>Xyz5</h1> <button>a button</button>`
})
export class XyzComponent {
}
This only happen when using @ngtools/webpack
and build as AoT
These are the conditions when it doesn’t work.
- when built with aot (without AoT it works fine)
- and in a separate library (as a vendor)
- and library contains a component
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Error When Building AOT Mode, on my Custom NPM Library
I get an error when I ng build --aot . The error message is: "ERROR in ./src/app/app.module.ngfactory.js" "Module not found: Error: Can't ...
Read more >Do you know how Angular transforms your code? - Medium
Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an ......
Read more >Angular AOT compilation with Webpack | Jiayi's Chronicles
Recently I've been dealing very often with Angular 2+ AOT compilation in Webpack and I've always found it an exhausting activity.
Read more >Angular 2 AOT Compilation - ANGULARarchitects
I'm subdividing this writing into two parts: Part 1: Angular 2 AOT Compilation and Tree Shaking with Webpack2 and/or Rollup (this one); Part...
Read more >@ngtools/webpack | Yarn - Package Manager
Webpack plugin that AoT compiles your Angular components and modules. ... ccc8e0350, fix, display actionable error when a style does not exist in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@stephenlautier, Thank you, kind sir! Worked like a charm.
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.