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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ivy compiler cannot find deep imports from ES6 peer dependency of library #16635

Closed
wulfsberg opened this issue Jan 10, 2020 · 4 comments
Closed

Ivy compiler cannot find deep imports from ES6 peer dependency of library #16635

wulfsberg opened this issue Jan 10, 2020 · 4 comments

Comments

@wulfsberg
Copy link

@wulfsberg wulfsberg commented Jan 10, 2020

馃悶 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Works under non-Ivy compiler

Description

Some ES6 imports in a library causes a compile error when a project using the library is compiled with Ivy.

馃敩 Minimal Reproduction

I have a project structure with an app (my-app) depending on an (private) npm-deployed Angular library (map-ui-lib), which in turn has a peer dependency to OpenLayers, which is a pure ES6 project with typings in DefinitelyTyped.

map-ui-lib uses deep imports like import { WMTS } from 'ol/source'; from OpenLayers.

If map-ui-lib is compiled with --prod to disable Ivy, as recommended for libraries by https://next.angular.io/guide/ivy#maintaining-library-compatibility, attempting to use the library in my-app results in

ERROR in The target entry-point "map-ui-lib" has missing dependencies:
 - ol/source

If I disable Ivy in my-app, the application compiles and works.

Correspondingly, if I compile map-ui-lib with Ivy and deploy (as a file reference to a tarball, to circumvent the prohibition on publishing Ivy-based libraries), and compile my-app with Ivy, it works.

(Compiling my-app with Ivy disabled while attempting to use the Ivy-based library unsurprisingly yields a factory error).

In short: A library using deep ES6 imports compiled as non-Ivy fails when used in an Ivy project, and Ivy-based libraries are explicitly prohibited.

馃敟 Exception or Error

ERROR in The target entry-point "map-ui-lib" has missing dependencies:
 - ol/source

馃實 Your Environment




Angular CLI: 9.0.0-rc.8
Node: 12.13.1
OS: win32 x64

Angular: 9.0.0-rc.8
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.8
@angular-devkit/build-angular     0.900.0-rc.8
@angular-devkit/build-optimizer   0.900.0-rc.8
@angular-devkit/build-webpack     0.900.0-rc.8
@angular-devkit/core              9.0.0-rc.8
@angular-devkit/schematics        9.0.0-rc.8
@ngtools/webpack                  9.0.0-rc.8
@schematics/angular               9.0.0-rc.8
@schematics/update                0.900.0-rc.8
rxjs                              6.5.4
typescript                        3.6.4
webpack                           4.41.2

Anything else relevant?
Will the ban on publishing Ivy libraries be lifted once v9 is released? If so, this behavior is not a problem for me, as I will simply embrace Ivy fully in the projects using this library, but if not, this will be a problem.
I am not sure if I can do some configuration to fix this, but the fact that it works under non-Ivy compilations makes it look more like a bug than a configuration error.

@petebacondarwin

This comment has been minimized.

Copy link
Member

@petebacondarwin petebacondarwin commented Jan 10, 2020

This is a known issue and should be fixed by angular/angular#34695

@wulfsberg

This comment has been minimized.

Copy link
Author

@wulfsberg wulfsberg commented Jan 10, 2020

Oh, nice! I couldn't find an existing report, but I didn't think to look in open pull requests :-D

@wulfsberg wulfsberg closed this Jan 10, 2020
@petebacondarwin

This comment has been minimized.

Copy link
Member

@petebacondarwin petebacondarwin commented Jan 10, 2020

Thanks for the report though! Keep us on our toes :-)

@wulfsberg

This comment has been minimized.

Copy link
Author

@wulfsberg wulfsberg commented Jan 10, 2020

Crosslinking with angular/angular#34720 for reference. It was in fact reported; I just didn't find it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can鈥檛 perform that action at this time.