Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport for multiple "entries" #50
Comments
|
Indeed - right now I have to run microbundle multiple times in order to handle disparate input-output flows. |
|
So I was thinking how this thing can be handled, I think there are 2 fundamental ways of providing this feature (I'll talk about them later) At the moment there is a possibility to pass multiple entry points, even with a glob pattern and for each of the entry points Actually we could also support additional targets, but how to do that have to be figured out. What I mean by additional targets? React Native ( Also ideally we could run a single command of Configuration At the moment when configuring multiple entries we can specify both input files and output directory, but it cannot quite work like that - when providing additional/alternative entries we need to reflect entry name in the package's directory structure. So actually we have 2 options for this: Convention We could support special My choice would be... A mix of configuration and convention approaches - I wouldn't ignore output option ever and create "proxy" directories based on the convention (structure of the source directory). That way all of the created files would be in a single directory (clarity) and we would have a nice way of specifying additional entries (opt-in when options gets used) with automatic creation of "proxy" directories. Additional notes Additional "main" entries - react-native, browser Similar thing could be done for browsers, but we would have to "invent" (?) |
|
I think I'd prefer to have Microbundle generate directories with derived |
Could you elaborate on this? There is no parity at the moment (w are flat bundling) between src and dist. I think convention files are more error-prone, so I'd suggest configuration is a better choice for this. Anyhow - I've started working on this slowly, hopefully I'll present a PR soon-ish, so we can discuss used approach then. |
|
Ah but there is, just it's only for multiple entries: their names and locations are mirrored in |
|
Would be great to add a test for this to see whats the expected result. By quickly inspecting |
|
OK, i think I've found example use of what you were talking about (which is
Need to look later how unistore/stockroom are different (maybe they just do not refer to each other? i suspect now that they do not refer to their "entries" directly, but probably just to some other imported internal modules and thats why other modules get duplicated - which also doesnt seem ok) or if Ive missed something when inspecting them. I'm not sure yet, because I haven't experimented with this freshness in rollup yet, that ultimately we should use code-splitting (which is available already). This would simplify the microbundle's code, make those things more automatic and we could end up with no duplication between outputted files. |
|
Seriously, i still can't understand for what you are talking about Rollup support multiple entry points anyway, even without the code splitting and etc, just pass array to |
|
Regarding
I think what you mean is that multiple configuration can be passed to rollup in array form, i.e. export default [cjsConfig, esConfig, umdConfig]Those configs would be completely separate though and we'd ideally would like to end up with 0 repetition between output bundles. |
|
Oh yea yea, I was sleepy Yup, finally got it. And recently i backed to the @rolldown, so i quickly implemented it in few lines, of course plus bonus features as it was dreamt. Support rich config files, multiple entry points and basic placeholders. Creates the following bundles
|
|
Is this feature still being worked on? Keen to see it implemented! |
|
I find it confusing that's cited as a feature in the Line 17 in 1ac4ccc |
|
Same @leonardodino Is there already a way to support multiple entry modules? Or is the README wrong? If there is already a way to support multiple non-disparate entry modules, it should probably be documented otherwise it's just confusing to say it exists but not say how to use it |
I'm trying to do the same thing, I want to create a single package for a collection of React components but make it possible for users to access sub components without having to import everything else. Struggling to find a way to do this at the moment. |
|
@gregrafferty No need for separate bundles. Just use named exports and all popular bundlers will take care of the rest via tree-shaking. |
Ah that's great, thanks for the info. I've had a few problems with this in the past so sometimes I get a bit paranoid about it! |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.



Having this implemented would resolve this issue.
The idea is that we need to output private
package.jsonfiles to support appropriate es/cjs resolving, I believe that @kentcdodds got it "right" here. Although you might prefer having some convention for creating additional "entries" over additional config flag.I will work on implementing this, hopefully some time soon~