question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Embedded option setting

See original GitHub issue

Type of Issue

[v] Bug Report
[ ] Feature Request

Description

My library depend on highcharts.

After build , it shows below error

ERROR in ./libs/test-toolkit/fesm5/test-toolkit.js
Module not found: Error: Can't resolve 'highcharts' in '/ilabs/project/test-project/toolkit-test/libs/test-library/fesm5'

it seems ngpackagr didn’t bundle highcharts for me.

ng-package setting as below

{
  "name": "test-library",
  "version": "1.0.0",
  "ngPackage": {
    "$schema": "../node_modules/ng-packagr/ng-package.schema.json",
    "lib": {
      "entryFile": "index.ts",
      "embedded": [
        "highcharts"
      ],
      "umdModuleIds": {
        "highcharts": "Highcharts",
      }
    },
    "dest": "test-library",
    "whitelistedNonPeerDependencies": ["."]
  },
  "peerDependencies": {
    "@angular/animations": ">=6.0.0",
    "@angular/common": ">=6.0.0",
    "@angular/compiler": ">=6.0.0",
    "@angular/core": ">=6.0.0",
    "@angular/forms": ">=6.0.0",
    "rxjs": ">=6.0.0"
  },
  "dependencies": {
    "@angular/animations": "^6.1.6",
    "@angular/cdk": "^6.3.1",
    "@angular/common": "^6.1.6",
    "@angular/compiler": "^6.1.6",
    "@angular/core": "^6.1.6",
    "@angular/forms": "^6.1.6",
    "@angular/material": "^6.3.1",
    "@angular/platform-browser": "^6.1.6",
    "@angular/router": ">=6.0.2",
    "rxjs": "^6.3.2",
    "zone.js": "^0.8.26",
    "highcharts": "^6.1.4"
  },
  "devDependencies": {
    "highcharts": "^6.1.4",
  }
}

How To Reproduce

A bug: please include instructions how to reproduce. Issues without reproduction are likely to receive no feedback.

Can you reproduce the error in the integration tests in ng-packagr? If possible, take a look at the integration/samples and try to break one of these builds!

Is the error you faced in an application importing the library Try to break the Angular CLI app in integration/consumers/ng-cli!

Expected Behaviour

What should I do if I want to consumer using my library without install highcharts?

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr:            4.2.0
@angular/compiler:     6.1.8
rollup:                0.66.2
tsickle:               0.32.1
typescript:            2.7.2

Please include all version numbers that might be relevant, e.g. third-party libraries

“highcharts”: “^6.1.4”

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
dhergescommented, Sep 30, 2018

Hi all,

my personal experience: I would not use bundledDependencies nor embedding any more. In the first place, we were using it for proprietary non-public third party dependencies. Why we eventually were comfortable with it? Because of the architecture/environment in which our applications and libraries were running we were safe to not have conflicting versions - actually, we were ‘forced’ to embed the proprietary code because we didn’t want to expose it to public APIs. If that’s the case, it’s the only use case I think of where it’s ok to do embedding/bundling. (In the meantime, we changed the architecture and don’t do it anymore)

For most (every) open source project I’d recommend to use peerDependencies. Give your consumers some choice: choice to resolve version conflicts, choice to use or to not use dependency APIs directly.

2reactions
shadizar128commented, May 20, 2020

Hi,

I’m getting the following warning when I use ‘bundledDependencies’:

Inlining of ‘bundledDependencies’ has been deprecated in version 5 and will be removed in future versions.

What is the alternative? If we use ‘peerDependencies’ the final UMD file will not contain the required dependencies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Embedded Option Definition - Investopedia
An embedded option is a feature of a financial instrument that lets issuers or holders take specified actions against the other party at...
Read more >
Embedded Option - Definition, Valuation, and Types
An embedded option is a provision in a financial security (typically in bonds) that provides an issuer or holder of the security a...
Read more >
Embedded option - Wikipedia
An embedded option is a component of a financial bond or other security, which provides the bondholder or the issuer the right to...
Read more >
Valuation and Analysis of Bonds with Embedded Options
An embedded option represents a right that can be exercised by the issuer, by the bondholder, or automatically depending on the course of...
Read more >
A Beginner's Guide to Embedded Options in Bonds
When an investor buys an embedded option bond, they are buying a bond with an option attached to it. For instance, a person...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found