Ngx-bootstrap: Module parse failed: Identifier 'setAllStyles$$1' has already been declared

Created on 19 Feb 2019  路  14Comments  路  Source: valor-software/ngx-bootstrap

Bug description or feature request:

Compile fails since version 3.3.0 with:

ERROR in ../node_modules/ngx-bootstrap/bundles/ngx-bootstrap.es2015.js 25634:9
Module parse failed: Identifier 'setAllStyles$$1' has already been declared (25634:9)
You may need an appropriate loader to handle this file type.
| }
| 
> function setAllStyles$$1(data, renderer) {
|     const target = data.instance.target;
|     const offsets = getOffsets$1(data);

Reverting to version 3.2.0 solves the issue.

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 3.3.0

Angular: 7.2.5

Bootstrap: 4

Build system: Angular CLI, System.js, webpack, starter seed:

Angular CLI: 7.3.2
Node: 10.15.1
OS: linux x64
Angular: 7.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.2
@angular-devkit/build-angular     0.12.4
@angular-devkit/build-optimizer   0.12.4
@angular-devkit/build-webpack     0.12.4
@angular-devkit/core              7.3.2
@angular-devkit/schematics        7.3.2
@angular/cli                      7.3.2
@ngtools/webpack                  7.2.4
@schematics/angular               7.3.2
@schematics/update                0.13.2
rxjs                              6.4.0
typescript                        3.2.4
webpack                           4.28.4

feat(chronos)

Most helpful comment

@Domainv I did some more investigations, here's my results:

1) The bug is only present when you set "target": "es6" in tsconfig.json. If you use es5 it's fine.

2) It looks like that injecting BsModalRef inside a component is causing the issue, but I'm not sure if that's the only cause or there is more behind it.

import { Component } from '@angular/core';
import { BsModalRef } from 'ngx-bootstrap';

@Component({...})
export class ConfirmLeaveComponent {
  constructor(
    public bsModalRef: BsModalRef,
  ) { }
}

All 14 comments

@FrancescoBorzi
If you'll create a small repo with reproducing it helps a lot

Sure, however I'm not sure yet how to reproduce this since I don't know what exactly is causing this. More investigations is needed. If I find something useful, I will write it here.

Should anyone else also get this issue, please leave a comment.

@Domainv I did some more investigations, here's my results:

1) The bug is only present when you set "target": "es6" in tsconfig.json. If you use es5 it's fine.

2) It looks like that injecting BsModalRef inside a component is causing the issue, but I'm not sure if that's the only cause or there is more behind it.

import { Component } from '@angular/core';
import { BsModalRef } from 'ngx-bootstrap';

@Component({...})
export class ConfirmLeaveComponent {
  constructor(
    public bsModalRef: BsModalRef,
  ) { }
}

Related with #5086

@Domainv any news about this ?

@FrancescoBorzi Finally, have time for it, I'll start work on the issue from Monday.

@Domainv since it's a critical issue, can you please draft a minor release with it ?

@FrancescoBorzi I can do it at the end of Friday.
It's ok for you?

Yes, that is fine. Thank you

This is happening for me when targeting esnext

@jrquick17 Which version of ngx-bootstrap?

@Domainv It happens for me in both version 3.3.0 and 4.0.0. I had to revert to 3.2.0 in order to compile.

@jrquick17 It fixed in 4.0.1 version

That did it, thank you! @Domainv

Was this page helpful?
0 / 5 - 0 ratings