Library multiple entry points
See original GitHub issueExactly the same as that issue that was closed by the bot but without any solution.
Description
I want to have the option to publish a library with two endpoints. i.e.
@my-scope/testing/e2e
@my-scope/testing/unit-tests
Where in the e2e
I want to include Cypress
utils (with Cypress dependency)
and in unit-tests
I want to include Jasmine
utils (with Jasmine dependency)
Motivation
Currently, I can’t do the above as both Cypress & Jasmine have an expect
global method,
so when I import @my-scope/testing
it imports both dependencies.
And tree-shaking in general.
- worth mentioning - I’m using NX to generate libraries monorepo, and I’m using the libraries in external projects (not inside the monorepo, that’s why I can’t start it as an Angular-monorepo and only use the basic Node approach).
Suggested Implementation
Same as ng-packager: create a package.json (name, dependencies) under the needed library with index.ts as an entry-point.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:15
- Comments:52 (6 by maintainers)
Top Results From Across the Web
Building an Angular Library with multiple entry points | Articles
An Angular library lets you share code between multiple projects. For a larger library it's recommended to use subentry points. We'll build a ......
Read more >Build a JavaScript library with multiple entry points using Vite3
In this post, I'll show how you can create a lib with multiple entry points (sub-modules) using Vite 3.
Read more >Creating Secondary Entry Points for your Angular Library
In this article, we will take a look at how we can utilise ng-packagr secondary entry points to split our Angular Library even...
Read more >Why and how to use secondary entrypoints in your Angular ...
By adding secondary entrypoints, we basically split our Angular libraries into multiple chunks, just like Angular Material does. A Example:.
Read more >webpack - Dynamic library option with multi entry points
From webpack 3.1.0, you can export multi configurations from webpack.config.js. So you can try the following: module.exports = [ { entry: ".
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Managed to workaround it by doing this:
under my lib directory i created a rollup config that extends nx one
in
libs/mylib/package.json
i addedand in
workspace.json
under the lib build script:and in order for it to work in the workspace as well, add in
tsconfig.base.json
Hope it helps 🙏
Not stale 🎈