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.

Allow each Component to be imported from respective root folder: multi-entry support

See original GitHub issue

Sorry for the question, but I could not find info in the docs on how to do this.

I have a library of React Components with a source structure similar to: https://github.com/mui-org/material-ui/tree/master/packages/material-ui/src

Is it possible to setup TSDX to build the library so that one can import individual components from their individual root folders?

   import Avatar from 'my-library/Avatar';
   import Button from 'my-library/Button';

Currently using TSDX we are forced to import all the components from the root index

   import { Avatar, Button } from 'my-library';

Thank you.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
brainkimcommented, Mar 9, 2020

@ambroseus I had some of the same thoughts today after wrestling with rollup configs and deployment for a new library I wanted to publish. As far as I can tell, rollup’s value propositions are threefold. It allows you to:

  1. parse and compile esmodules to other formats for dependents
  2. defensively bundle your dependencies (protecting you from left-pad or whatever)
  3. tree-shake dependencies

Doesn’t 1 become obsolete when esmodules are available everywhere? And if 1 is gone, I really can’t recommend rollup for 2 or 3 insofar as with 2, I think you should either trust your dependencies or copy-paste them into your codebase, and with 3 I have never been able to cleanly add a dependency to a rollup project without having to deal with one or several of the errors/warnings listed here: https://rollupjs.org/guide/en/#troubleshooting. Rollup is an incredibly finicky consumer of code and rarely am I able to just install a dependency and get it to just compile without tweaking rollup.config.js.

I dunno.

1reaction
ambroseuscommented, Mar 9, 2020

OFF TOPIC

Why in 2020 we still use bundlers with so complex configs/plugins ?? modern browsers/node 12 already support native modules import so why not to throw out webpack/parcell/rollup and start using https://www.snowpack.dev ? 😃

With Snowpack you can build modern web apps (using React, Vue, etc.) without a bundler (like Webpack, Parcel, Rollup). No more waiting for your bundler to rebuild your site every time you hit save. Instead, every change is reflected in the browser instantly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading a component root folder into a sandbox - IBM
Procedure. Before you begin, import file and folders from Rational ClearCase. Load a shared Rational Team Concert root folder by completing the ...
Read more >
Multiple entry points in create-react-app without ejecting
Let's look at the default entry point in a CRA application. The src/index.js file imports the App container and renders it inside the...
Read more >
Modules: Packages | Node.js v19.3.0 Documentation
This ensures that there is only one subpath for each exported module so that all dependents import the same consistent specifier, keeping the...
Read more >
Get started with the Navigation component - Android Developers
In an app with multiple activity destinations, each activity has its own navigation graph. Add a NavHostFragment via XML. The XML example below ......
Read more >
Dependency resolution - Parcel
All extensions listed above are supported for index files. /path/to/project/src/app.js: import './client' ...
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