angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Promise generated by writeBuffer() from exceljs is broken in production

Open Senneseph opened this issue 7 years ago β€’ 15 comments

🐞 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).

Senneseph avatar Jun 11 '19 14:06 Senneseph

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

filipesilva avatar Jun 13 '19 09:06 filipesilva

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.

Senneseph avatar Jun 13 '19 15:06 Senneseph

Having the same problem in app with Angular 7.2.14

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```

miiihi avatar Jun 13 '19 15:06 miiihi

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",

gokme avatar Jun 18 '19 08:06 gokme

Having the same problem in app with Angular 8.0.0

MohammedHelly avatar Jun 21 '19 15:06 MohammedHelly

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

Senneseph avatar Jun 21 '19 15:06 Senneseph

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

rahulrastogi-git avatar Jun 24 '19 03:06 rahulrastogi-git

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.

SandipanThorat00 avatar Jun 26 '19 08:06 SandipanThorat00

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

Senneseph avatar Jun 26 '19 14:06 Senneseph

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

rahulrastogi-git avatar Jun 26 '19 14:06 rahulrastogi-git

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

mgechev avatar Jun 27 '19 01:06 mgechev

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

Senneseph avatar Jun 28 '19 16:06 Senneseph

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

MohammedHelly avatar Jun 28 '19 16:06 MohammedHelly

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.

GitAlison avatar Jul 16 '19 06:07 GitAlison

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.