Angular-cli: Promise generated by writeBuffer() from exceljs is broken in production

Created on 11 Jun 2019  路  15Comments  路  Source: angular/angular-cli

馃悶 Bug report

Command (mark with an x)


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

Is this a regression?


Yes, the previous version in which this bug was not present was: 7.x

Description


In my project, I use the exceljs library for some light spreadsheet manipulation. However, with Angular 8, there's something going wrong with the build. On the dev server, calls to writeBuffer()'s promise complete as expected. But once the production build is created, it's like the promise writeBuffer() creates is never run.

馃敩 Minimal Reproduction

Here is a stackblitz which captures the basics of the problem; however, note that for the stackblitz, writeBuffer() works (I believe it's running in development mode). https://stackblitz.com/edit/angular-xi5bzs

This library has been working since Angular 4, but maybe I importing it incorrectly.

This is how I make the library available to my app. In tsconfig.json:

tsconfig.json


{
  "compileOnSave": false,
  "compilerOptions": {
    "paths": {
      "exceljs": ["node_modules/exceljs/dist/exceljs.min"],
    },
  ...

馃實 Your Environment




Angular CLI: 8.0.1
Node: 10.15.3
OS: linux x64
Angular: 8.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.1
@angular-devkit/build-angular     0.800.1
@angular-devkit/build-optimizer   0.800.1
@angular-devkit/build-webpack     0.800.1
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.1
@angular/cli                      8.0.1
@ngtools/webpack                  8.0.1
@schematics/angular               8.0.1
@schematics/update                0.800.1
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?

Happens for both ES5 and ES6 targets, Chrome and IE11 (no other browsers tested).

devkibuild-optimizer low regression bufix

Most helpful comment

Problem is with ExcelJs, same code with 1.10.0 works but not with 1.12.2.

All 15 comments

If I had to bet, it's related to Build Optimizer. Can you try turning it off in your angular.json?

Thanks for the input, @filipesilva, however, turning off build optimizer didn't change the behavior.

In my angular.json:

{
  "projects": {
    "excel-test": {
    ...,
      "architect": {
        "build": {
          ...,
          "options": {
          ...,
          "configurations": {
            "production": {
              ...,
              "buildOptimizer": false,

It could be something about this particular library - the whole thing is pulled in even if you are using a subset of the functionality.

Having the same problem in app with Angular 7.2.14

```Angular CLI: 7.3.8
Node: 8.12.0
OS: win32 x64
Angular: 7.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package Version

@angular-devkit/architect 0.13.8
@angular-devkit/build-angular 0.13.8
@angular-devkit/build-optimizer 0.13.8
@angular-devkit/build-webpack 0.13.8
@angular-devkit/core 7.3.8
@angular-devkit/schematics 7.3.8
@angular/cdk 7.3.7
@angular/cli 7.3.8
@angular/flex-layout 7.0.0-beta.24
@angular/material 7.3.7
@angular/pwa 0.13.8
@ngtools/webpack 7.3.8
@schematics/angular 7.3.8
@schematics/update 0.13.8
rxjs 6.5.1
typescript 3.2.4
webpack 4.29.0```

Facing the same issue.

Works perfectly fine in development environment. But in production fails miserably.

Node: 8.9.4
OS: win x64
Angular: 7.X
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package Version

"@angular/animations": "~7.1.0",
"@angular/cdk": "^7.3.7",
"@angular/common": "~7.1.0",
"@angular/compiler": "~7.1.0",
"@angular/core": "~7.1.0",
"@angular/forms": "~7.1.0",
"@angular/material": "^7.3.7",
"@angular/platform-browser": "~7.1.0",
"@angular/router": "~7.1.0",

Having the same problem in app with Angular 8.0.0

@filipesilva
Forgot to update this, yes I tried turning of the build optimizer but it didn't change anything. It may be that it's a problem with the library itself, but it's so weird that the functions totally cease to work - no error messages, no exceptions, or anything.

hi all,
facing same issue (angular 7), based on previous conversation both angular 7 and 8 are having same issue, could it be ExcelJs issue then?

any alternate? like writetofile? or previous version of exceljs ?

thanks

Hi all,
exceljs 1.10.0 works for me with angular 7.2.2.
I was facing the same issue with exceljs 1.12 and 1.13 in angular 7.2.2,
I downgrade the exceljs version to 1.10.0 and it works for me in angular 7.2.

@sandipnthorat Do you know if this is an issue with the Angular build environment or with the structure of the Exceljs library?

Rolling back worked for me.

Problem is with ExcelJs, same code with 1.10.0 works but not with 1.12.2.

If you verify the problem is coming from exceljs, we can close this issue?

@mgechev Yes, I am going to close this now and continue investigating on the ExcelJS side.

It is now working on angular 8 after downgrade the exceljs version to 1.10.0
Go ahead and close it
Thanks

Angular CLI: 7.3.8
Node: 10.16.0
OS: darwin x64
Angular: 7.2.14
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.12.1
@angular-devkit/build-angular 0.12.1
@angular-devkit/build-optimizer 0.12.1
@angular-devkit/build-webpack 0.12.1
@angular-devkit/core 7.2.1
@angular-devkit/schematics 7.3.8
@angular/cdk 7.3.6
@angular/cli 7.3.8
@ngtools/webpack 7.2.1
@schematics/angular 7.3.8
@schematics/update 0.13.8
rxjs 6.5.1
typescript 3.2.4
webpack 4.23.1

WORKING in 1.10
thanks guys.

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