Angular-cli: Rollup config error on dynamic import during library build

Created on 16 May 2019  路  2Comments  路  Source: angular/angular-cli

馃悶 Bug report

- [ ] new
- [ x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

No

Description

Consider building foo library with the command ng build foo.
When the library contains a file (service in my case), which uses dynamic import, the build will fail throwing error below. This happens in v7 and also after upgrading to v8.0.0-rc.4

馃敩 Minimal Reproduction

  1. Create a new project. Generate library ng g library foo.
  2. Create a service in the library that is using dynamic imports. (example screenshot below)
  3. Export service in public-api.ts
  4. Build library with ng build shared
    Capture

馃敟 Exception or Error



Building Angular Package
Building entry point 'testik'
Compiling TypeScript sources through ngc
Bundling to FESM2015

BUILD ERROR
You must set "output.dir" instead of "output.file" when generating multiple chunks.
Error: You must set "output.dir" instead of "output.file" when generating multiple chunks.
    at error (c:\Development\rollup-test\node_modules\rollup\dist\rollup.js:3410:30)
    at normalizeOutputOptions (c:\Development\rollup-test\node_modules\rollup\dist\rollup.js:17107:13)
    at getOutputOptions (c:\Development\rollup-test\node_modules\rollup\dist\rollup.js:16865:24)
    at Object.write (c:\Development\rollup-test\node_modules\rollup\dist\rollup.js:16957:43)
    at Object. (c:\Development\rollup-test\node_modules\ng-packagr\lib\flatten\rollup.js:46:22)
    at Generator.next ()
    at fulfilled (c:\Development\rollup-test\node_modules\ng-packagr\lib\flatten\rollup.js:4:58)

馃實 Your Environment


Angular CLI: 8.0.0-rc.4
Node: 10.15.0
OS: win32 x64
Angular: 8.0.0-rc.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.800.0-rc.4
@angular-devkit/build-angular      0.800.0-rc.4
@angular-devkit/build-ng-packagr   0.800.0-rc.4
@angular-devkit/build-optimizer    0.800.0-rc.4
@angular-devkit/build-webpack      0.800.0-rc.4
@angular-devkit/core               8.0.0-rc.4
@angular-devkit/schematics         8.0.0-rc.4
@angular/cdk                       8.0.0-rc.1
@angular/flex-layout               7.0.0-beta.24
@angular/material                  8.0.0-rc.1
@ngtools/json-schema               1.1.0
@ngtools/webpack                   8.0.0-rc.4
@schematics/angular                8.0.0-rc.4
@schematics/update                 0.800.0-rc.4
ng-packagr                         5.1.0
rxjs                               6.5.2
typescript                         3.4.5
webpack                            4.30.0

Anything else relevant?

All 2 comments

I'm sorry, but this issue is not caused by Angular CLI. Please contact the author(s) of the ng-packagr project or file an issue on their issue tracker.

Note: at the moment this is not supported by ng-packagr.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IngvarKofoed picture IngvarKofoed  路  3Comments

sysmat picture sysmat  路  3Comments

hartjo picture hartjo  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

delasteve picture delasteve  路  3Comments