ngx-bootstrap: 'DropdownModule' is not exported by node_modules\ng2-bootstrap\ng2-bootstrap.js

Trying to use rollup for treeshaking as desribed here:http://blog.mgechev.com/2016/06/26/tree-shaking-angular2-production-build-rollup-javascript/ Getting the error 'DropdownModule' is not exported by node_modules\ng2-bootstrap\ng2-bootstrap.js when running rollup.

Any idea what the issue could be? es2015 instead of es5?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

DropdownModule renamed to BsDropdownModule

@markbatbean, I was wrong. As I change the version I had to follow the new method to use the dropdown.

As you can see here (http://valor-software.com/ng2-bootstrap/#/dropdowns#usage)

// RECOMMENDED (doesn't work with system.js)
import { BsDropdownModule } from 'ng2-bootstrap/dropdown';
// or
import { BsDropdownModule } from 'ng2-bootstrap';

@NgModule({
  imports: [BsDropdownModule.forRoot(),...]
})
export class AppModule(){}

Im getting this same error and don’t know how to fix it with rollup-plugin-commonjs

'DropdownModule' is not exported by node_modules\ng2-bootstrap\ng2-bootstrap.js (imported by app\shared\navigation\navigation.module.js). For help fixing this error see https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module

Error: 'DropdownModule' is not exported by node_modules\ng2-bootstrap\ng2-bootstrap.js (imported by app\shared\navigation\navigation.module.js). For help fixing this error see https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module at Module.trace (C:\Projects\NeilKellyClient4\node_modules\rollup\src\Module.js:362:30) at ModuleScope.findDeclaration (C:\Projects\NeilKellyClient4\node_modules\rollup\src\ast\scopes\ModuleScope.js:47:22) at Scope.findDeclaration (C:\Projects\NeilKellyClient4\node_modules\rollup\src\ast\scopes\Scope.js:92:39) at Identifier.bind (C:\Projects\NeilKellyClient4\node_modules\rollup\src\ast\nodes\Identifier.js:7:29) at C:\Projects\NeilKellyClient4\node_modules\rollup\src\ast\Node.js:6:34 at ArrayExpression.eachChild (C:\Projects\NeilKellyClient4\node_modules\rollup\src\ast\Node.js:18:20) at ArrayExpression.bind (C:\Projects\NeilKellyClient4\node_modules\rollup\src\ast\Node.js:6:8) at C:\Projects\NeilKellyClient4\node_modules\rollup\src\ast\Node.js:6:34 at Node.eachChild (C:\Projects\NeilKellyClient4\node_modules\rollup\src\ast\Node.js:21:5) at Node.bind (C:\Projects\NeilKellyClient4\node_modules\rollup\src\ast\Node.js:6:8)

and if I git rid of DropdownModule, then same error with CollapseModule, etc

I’m getting similar error to @rochapablo

"@angular/cli": "^1.0.0",
"@angular/compiler-cli": "^2.3.1",
"ng2-bootstrap": "^1.2.5",

No changes were made to my code - yesterday it was working, today it isn’t. I even restored from a previously functioning archive and now: npm start fails

npm start

> campus@0.0.0 start /Users/marbradley/Workspace/campus-ui > ng serve --proxy-config api-proxy.json

** NG Live Development Server is running on http://localhost:4200 ** Hash: 086efd657bb372f7edd3
Time: 19444ms chunk {0} main.bundle.js, main.bundle.js.map (main) 141 kB {2} [initial] [rendered] chunk {1} styles.bundle.js, styles.bundle.js.map (styles) 317 kB {3} [initial] [rendered] chunk {2} vendor.bundle.js, vendor.bundle.js.map (vendor) 4.57 MB [initial] [rendered] chunk {3} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]

WARNING in ./src/app/dashboard/dashboard.module.ts 35:16-30 "export 'DropdownModule' was not found in 'ng2-bootstrap'

WARNING in ./src/app/college-summary/college-summary.module.ts 39:16-30 "export 'DropdownModule' was not found in 'ng2-bootstrap'

ERROR in campus-ui/src/app/dashboard/dashboard.module.ts (12,10): Module '"campus-ui/node_modules/ng2-bootstrap/index"' has no exported member 'DropdownModule'.

ERROR in campus-ui/src/app/college-summary/college-summary.module.ts (4,10): Module '"campus-ui/node_modules/ng2-bootstrap/index"' has no exported member 'DropdownModule'.

@quiringk - It looks like we’re troubleshooting this at almost the same time. I think I’ve figured it out. In my rollup-config.js, I added:

commonjs({ include: [‘node_modules/rxjs/', 'node_modules/ng2-bootstrap/’], })

without that, it seemed it wasn’t finding things in the ng2-bootstrap project.

@valorkin - Thanks for the great work in this module. I think the __export(…) function in your ng2-bootstrap.js might be tripping up the rollup tool. But rather than rearranging that, you might just add a note to the docs in your angular2-quickstart project about adding the above to your rollup config.