You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
postinstall ivy ngcc error there is no format with import statements xxx entry-point #29564
At postinstall ngcc throw "imports|entry-points" errors on 3th party lib.
By example with angular-tree-component and ngx-virtual-scroller 3th party lib.
🔬 Minimal Reproduction
Simply run command: ng new ap --minimal --defaults --skipInstall --enable-ivy && cd ap && npm i angular-tree-component && npm i ngx-virtual-scroller && npm install
Reacted by NaLLiFFuNT, Pavel Shurygin, Krzysztof Karol, man Q, Piernik, Michael Krone, Mehdi Saeedifar, DmitriyIvanko, Roger Padilla, Wangmeng and 9 more
In the latter case (Error: There is no format with import statements in 'C:/.../node_modules/ngx-virtual-scroller' entry-point.) we need a format to have import statements so that we can work out the dependencies between entry-points (and packages). This is because we must compile them in order (most dependended upon first).
It looks like this package only exposes one entry-point format via "main": "dist/virtual-scroller.js",. Looking at that file, this appears to be a CommonJS format. This format is on our roadmap to support - it is related to UMD, which is also on the roadmap.
That being said, I wonder if we could use .d.ts typings files to work out these dependencies 🤔
Regarding the former error (angular-tree-component : Entry point 'angular-tree-component' contains deep imports into ngx-virtual-scroller). I can't find where the angular-tree-component depends upon the ngx-virtual-scroller.
@petebacondarwin this is two different error for each lib.
First for angular-tree-component which seems only warning :
Entry point 'angular-tree-component' contains deep imports into 'lodash/defaultsDeep', 'lodash/get', 'lodash/omit', 'lodash/isNumber', 'lodash/first', 'lodash/last', 'lodash/some', 'lodash/every', 'lodash/compact', 'lodash/find', 'lodash/isString', 'lodash/isFunction', 'lodash/throttle', 'lodash/includes', 'lodash/pick'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Second is real error for ngx-virtual-scroller which throw :
Error: There is no format with import statements in 'C:/.../node_modules/ngx-virtual-scroller' entry-point.
@petebacondarwin I'm the maintainer of ngx-virtual-scroller. Can you advise on what code changes I can make to my library for it to be ivy compatible? You said the error was due to using CommonJS Module format. I've tried every module format (CommonJS, UMD, AMD, System, ESNext) & all of them give this identical error.
The only change I made was in tsconfig.json
"compilerOptions": {
"module": "commonjs",
}
to
"compilerOptions": {
"module": "ES2015",
}
(I iterated through each of the other options for module as well)
Is there something more I should be doing? What is the preferred module format?
Hi @speige - glad you found ng-packagr. It is a good tool and save a lot of hassle. Anyway in case you didn't get to the bottom of it. The problem was not that TS was compiling CommonJS format. It was that when you bundled the code you were not generating any bundle formats that ngcc (currently) cannot parse. This should be fixed in the future, but at the moment the vast majority of packages include bundles that are formatted as ES2015 or ES5 code with ES6 import and export statements, which can easily be consumed by bundlers like webpack, etc.
@petebacondarwin it seems Angular compiler failed to compile with first error too (angular-tree-component) I get :
ERROR in There is no typings path for TreeNodeWrapperComponent in C:/Users/.../node_modules/angular-tree-component/dist/components/tree-node-wrapper.component.d.ts.
We need to add an export for this class to a .d.ts typings file because Angular compiler needs to be able to reference this class in compiled code, such as templates.
The simplest fix for this is to ensure that this class is exported from the package's entry-point.
ERROR in ./node_modules/@angular/flex-layout/ivy_ngcc/esm2015/extended.js 133:578
Module parse failed: Unexpected token (133:578)
You may need an appropriate loader to handle this file type.
| }
| }
ERROR in ./node_modules/@angular/flex-layout/ivy_ngcc/esm2015/extended.js 133:578
Module parse failed: Unexpected token (133:578)
You may need an appropriate loader to handle this file type.
| }
| }
8.1.0-rc.0 fixed some areas. Now I am getting this instead
ERROR in ../node_modules/@angular/flex-layout/extended/typings/class/class.d.ts:30:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
30 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/extended/typings/img-src/img-src.d.ts:38:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
38 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/flex/typings/flex/flex.d.ts:50:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
50 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/align-columns/align-columns.d.ts:28:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
28 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/align-rows/align-rows.d.ts:28:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
28 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/areas/areas.d.ts:31:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
31 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/auto/auto.d.ts:31:23 - error TS2314: [0mGeneric type 'ɵɵBaseDef' requires 1 type argument(s).
31 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/columns/columns.d.ts:32:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
32 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/gap/gap.d.ts:31:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
31 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/rows/rows.d.ts:32:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
ℹ 「wdm」: Failed to compile.
ℹ 「wdm」: Compiling...
ERROR in node_modules/@angular/flex-layout/extended/typings/class/class.d.ts(30,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
node_modules/@angular/flex-layout/extended/typings/img-src/img-src.d.ts(38,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
node_modules/@angular/flex-layout/flex/typings/flex/flex.d.ts(50,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/align-columns/align-columns.d.ts(28,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/align-rows/align-rows.d.ts(28,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/areas/areas.d.ts(31,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/auto/auto.d.ts(31,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/columns/columns.d.ts(32,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/gap/gap.d.ts(31,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/rows/rows.d.ts(32,23): error TS2314: Generic type 'ɵɵBaseDef<T>' requires 1 type argument(s).
ERROR in There is no format with import statements in '[...]/node_modules/ng-inline-svg' entry-point.
Which comes after the following warning:
WARNING in Entry point 'angular-tree-component' contains deep imports into 'lodash/defaultsDeep', 'lodash/get', 'lodash/omit', 'lodash/isNumber', 'lodash/first', 'lodash/last', 'lodash/some', 'lodash/every', 'lodash/compact', 'lodash/find', 'lodash/isString', 'lodash/isFunction', 'lodash/throttle', 'lodash/includes', 'lodash/pick'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
@wottpal - This should be fixed. Can you confirm which version of Angular you are testing against? The ngcc fixes are only in the next versions, which currently is 8.2.0-next.0 (released yesterday).
vendor.js:68359 ERROR TypeError: Cannot read property 'init' of undefined
at DefaultFlexDirective.init (vendor.js:100713)
at new FlexDirective (vendor.js:105619)
at new DefaultFlexDirective (vendor.js:105735)
at vendor.js:68324
at NodeInjectorFactory.DefaultFlexDirective_Factory [as factory] (vendor.js:105739)
at getNodeInjectable (vendor.js:68188)
at instantiateAllDirectives (vendor.js:74464)
at createDirectivesAndLocals (vendor.js:73860)
at ɵɵelementStart (vendor.js:78758)
at TeflonComponent_Template (ng:///TeflonComponent.js:39)
defaultErrorLogger @ vendor.js:68359
main.js:2663 TypeError: Cannot read property 'init' of undefined
at DefaultFlexDirective.init (vendor.js:100713)
at new FlexDirective (vendor.js:105619)
at new DefaultFlexDirective (vendor.js:105735)
at vendor.js:68324
at NodeInjectorFactory.DefaultFlexDirective_Factory [as factory] (vendor.js:105739)
at getNodeInjectable (vendor.js:68188)
at instantiateAllDirectives (vendor.js:74464)
at createDirectivesAndLocals (vendor.js:73860)
at ɵɵelementStart (vendor.js:78758)
at TeflonComponent_Template (ng:///TeflonComponent.js:39)
@wottpal you issue does indeed appear to have the same cause as #31394. Please follow that issue for a resolution.
@kschwidder - please can you create a new issue for you problem, providing steps to reproduce the error.
I am closing this issue as it is becoming a catch-all for ngcc related issues and that makes it difficult to track what is broken and what is fixed. Please create new issues for failures when trying out ivy/ngcc (after searching for duplicate issues first!).
Activity
filipesilva commentedon Mar 28, 2019
@petebacondarwin @gkalpak do you know what is happening with these two packages and what can be done for them to work with Ivy?
petebacondarwin commentedon Mar 28, 2019
In the latter case (
Error: There is no format with import statements in 'C:/.../node_modules/ngx-virtual-scroller' entry-point.) we need a format to have import statements so that we can work out the dependencies between entry-points (and packages). This is because we must compile them in order (most dependended upon first).It looks like this package only exposes one entry-point format via
"main": "dist/virtual-scroller.js",. Looking at that file, this appears to be a CommonJS format. This format is on our roadmap to support - it is related to UMD, which is also on the roadmap.That being said, I wonder if we could use
.d.tstypings files to work out these dependencies 🤔petebacondarwin commentedon Mar 28, 2019
Regarding the former error (
angular-tree-component : Entry point 'angular-tree-component' contains deep imports into ngx-virtual-scroller). I can't find where the angular-tree-component depends upon the ngx-virtual-scroller.elvisbegovic commentedon Mar 28, 2019
@petebacondarwin this is two different error for each lib.
First for angular-tree-component which seems only warning :
Second is real error for ngx-virtual-scroller which throw :
petebacondarwin commentedon Mar 28, 2019
Cool. So the first is probably not a problem, since lodash does not contain code that needs to be compiled by ngcc anyway.
I will have a look at whether we can avoid all the problems of the second error by using typings files instead of formats with imports...
petebacondarwin commentedon Mar 28, 2019
Tracking at FW-1210
speige commentedon Apr 6, 2019
@petebacondarwin I'm the maintainer of ngx-virtual-scroller. Can you advise on what code changes I can make to my library for it to be ivy compatible? You said the error was due to using CommonJS Module format. I've tried every module format (CommonJS, UMD, AMD, System, ESNext) & all of them give this identical error.
The only change I made was in tsconfig.json
to
(I iterated through each of the other options for module as well)
Is there something more I should be doing? What is the preferred module format?
Thanks.
speige commentedon Apr 6, 2019
@petebacondarwin nevermind. I think I figured it out. I came across https://github.com/ng-packagr/ng-packagr which seems to fix my npm package format.
petebacondarwin commentedon Apr 6, 2019
Hi @speige - glad you found
ng-packagr. It is a good tool and save a lot of hassle. Anyway in case you didn't get to the bottom of it. The problem was not that TS was compiling CommonJS format. It was that when you bundled the code you were not generating any bundle formats that ngcc (currently) cannot parse. This should be fixed in the future, but at the moment the vast majority of packages include bundles that are formatted as ES2015 or ES5 code with ES6importandexportstatements, which can easily be consumed by bundlers like webpack, etc.speige commentedon Apr 7, 2019
@istiti I've released a new version to npm 2.0.6, could you test & see if the error is gone?
elvisbegovic commentedon Apr 8, 2019
@speige correct, error is gone
@petebacondarwin it seems Angular compiler failed to compile with first error too (angular-tree-component) I get :
51 remaining items
kschwidder commentedon Jun 27, 2019
Running the latest release 8.0.3
ERROR in ./node_modules/@angular/flex-layout/ivy_ngcc/esm2015/extended.js 133:578
Module parse failed: Unexpected token (133:578)
You may need an appropriate loader to handle this file type.
| }
| }
ERROR in ./node_modules/@angular/flex-layout/ivy_ngcc/esm2015/extended.js 133:578
Module parse failed: Unexpected token (133:578)
You may need an appropriate loader to handle this file type.
| }
| }
petebacondarwin commentedon Jun 27, 2019
@kschwidder - the version to use for testing ivy is 8.1.0-rc.0 and higher.
kschwidder commentedon Jun 28, 2019
8.1.0-rc.0 fixed some areas. Now I am getting this instead
ERROR in ../node_modules/@angular/flex-layout/extended/typings/class/class.d.ts:30:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
30 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/extended/typings/img-src/img-src.d.ts:38:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
38 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/flex/typings/flex/flex.d.ts:50:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
50 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/align-columns/align-columns.d.ts:28:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
28 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/align-rows/align-rows.d.ts:28:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
28 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/areas/areas.d.ts:31:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
31 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/auto/auto.d.ts:31:23 - error TS2314: [0mGeneric type 'ɵɵBaseDef' requires 1 type argument(s).
31 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/columns/columns.d.ts:32:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
32 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/gap/gap.d.ts:31:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
31 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
../node_modules/@angular/flex-layout/grid/typings/rows/rows.d.ts:32:23 - error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
32 static ngBaseDef: ɵngcc0.ɵɵBaseDef;
~~~~~~~~~~~~~~~~
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
ℹ 「wdm」: Failed to compile.
ℹ 「wdm」: Compiling...
Date: 2019-06-28T09:55:12.010Z - Hash: e370a87c7805c7380678
5 unchanged chunks
Time: 2598ms
ℹ 「wdm」: Compiled successfully.
kccsf commentedon Jun 28, 2019
@kschwidder #31160
wottpal commentedon Jul 2, 2019
@magnattic Did you fix your issue? I also get a problem like this with https://github.com/arkon/ng-inline-svg which prevents compilation when ivy is turned on:
Which comes after the following warning:
petebacondarwin commentedon Jul 3, 2019
@wottpal - This should be fixed. Can you confirm which version of Angular you are testing against? The ngcc fixes are only in the
nextversions, which currently is 8.2.0-next.0 (released yesterday).kschwidder commentedon Jul 3, 2019
+1: with 8.2.0-next.0 it is fixed !!!
The decrease of the bundle size is amazing ! Awesome work.
Well done. Thx a lot
wottpal commentedon Jul 3, 2019
@petebacondarwin Yes, I can confirm that as well. Error and Warning are gone.
Update: Even though it compiles now I get a Runtime-Error in Chrome (also from ng-inline-svg). Seems related:
(If you are wondering
experimentalDecoratorsis set totruein mytsconfig.json, of course)kschwidder commentedon Jul 3, 2019
I am getting a runtime error as follows too:
vendor.js:68359 ERROR TypeError: Cannot read property 'init' of undefined
at DefaultFlexDirective.init (vendor.js:100713)
at new FlexDirective (vendor.js:105619)
at new DefaultFlexDirective (vendor.js:105735)
at vendor.js:68324
at NodeInjectorFactory.DefaultFlexDirective_Factory [as factory] (vendor.js:105739)
at getNodeInjectable (vendor.js:68188)
at instantiateAllDirectives (vendor.js:74464)
at createDirectivesAndLocals (vendor.js:73860)
at ɵɵelementStart (vendor.js:78758)
at TeflonComponent_Template (ng:///TeflonComponent.js:39)
defaultErrorLogger @ vendor.js:68359
main.js:2663 TypeError: Cannot read property 'init' of undefined
at DefaultFlexDirective.init (vendor.js:100713)
at new FlexDirective (vendor.js:105619)
at new DefaultFlexDirective (vendor.js:105735)
at vendor.js:68324
at NodeInjectorFactory.DefaultFlexDirective_Factory [as factory] (vendor.js:105739)
at getNodeInjectable (vendor.js:68188)
at instantiateAllDirectives (vendor.js:74464)
at createDirectivesAndLocals (vendor.js:73860)
at ɵɵelementStart (vendor.js:78758)
at TeflonComponent_Template (ng:///TeflonComponent.js:39)
gkalpak commentedon Jul 3, 2019
These runtime errors might be related to #31394.
petebacondarwin commentedon Jul 3, 2019
@wottpal you issue does indeed appear to have the same cause as #31394. Please follow that issue for a resolution.
@kschwidder - please can you create a new issue for you problem, providing steps to reproduce the error.
I am closing this issue as it is becoming a catch-all for ngcc related issues and that makes it difficult to track what is broken and what is fixed. Please create new issues for failures when trying out ivy/ngcc (after searching for duplicate issues first!).
angular-automatic-lock-bot commentedon Sep 15, 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.