Skip to content

Cannot use linked lib in ejected cli project #5049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Dinistro opened this issue Feb 27, 2017 · 3 comments
Closed

Cannot use linked lib in ejected cli project #5049

Dinistro opened this issue Feb 27, 2017 · 3 comments

Comments

@Dinistro
Copy link

Dinistro commented Feb 27, 2017

OS?

Ubuntu 16.04

Versions.

@angular/cli: 1.0.0-rc.0 (e)
node: 7.5.0
os: linux x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.8
npm: 4.1.2

Repro steps.

  1. Clone an ng-bootstrap and link it:
git clone https://github.com/ng-bootstrap/ng-bootstrap.git
cd ng-bootstrap
gulp build
cd dist/
npm link
  1. Create new cli project and execute ng eject
  2. Link ng-bootstrap into your new project:
npm link @ng-bootstrap/ng-bootstrap 
  1. Import the NgbModule in the app.module.ts:
...
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    ...,
    NgbModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

  1. Execute npm start

The log given by the failure.

In the browsers console, you will see an error like this:

Error: Unexpected value '[object Object]' imported by the module 'AppModule' ...

Mention any other details that might be useful.

After some debugging, I noticed, that ng-bootstrap was bundled in the main.bundle.js and not in the vendor.bundle.js. It's peerDependencies were as well in the main.bundle.js.

@Dinistro
Copy link
Author

After some more debugging, I noticed, that ng-bootstrap is also bundled in the main.bundle.js if the project isn't ejected. But the peerDependencies aren't added to the main.bundle.js, like it should be.

@filipesilva
Copy link
Contributor

I'm sorry but after you eject you're on your own. We try to guarantee it works for the majority of cases via tests but now you have a webpack config so you should be able to adapt it at will.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants