You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using multiple entries in the preset options, the generated tsup configurations merge all entries into a single object, making it impossible to apply different configurations to different entries. An example of this would be
From the above, it looks like we get two outputs where one has DTS as true and the other undefined -- in other words, one is defined for types and the other is not.
If say, I wanted to go ahead and add custom option configuration depending on the target name like so, I cannot do it:
consttsupOptions=preset.generateTsupOptions(parsedOptions).map((tsupOption)=>{// tsupOption.name is always undefinedif(tsupOption.name==="testUtils"){return{name: "@org/solid/testUtils", ...tsupOption};}return{name: "@org/solid",minify: true, ...tsupOption};});
Expected Behavior
Unless I'm missing something, each entry should generate its own build configuration, allowing for per-entry customization (or perhaps make this behavior configurable by adding some option to tsup-preset-solid to allow for it):
Moreover on the above, after generating the tsup options via preset.generateTsupOptions, I would expect the name value to be populated so that each one can be identified.
Additional Context
The package.json exports are generated correctly with separate paths for each entry, but the build configurations don't maintain this separation.
Last Thoughts
Feel free to correct me if I have the wrong impression of how all of this is supposed to work. I'm still something of an "advanced beginner" when it comes to bundling and I may be suggesting something unhealthy here.
The text was updated successfully, but these errors were encountered:
Separating build config for each entry would make reusing code between entries impossible. If you used index in testUtils it would be duplicated.
Also it makes the whole build faster if you only call esbuild.build twice not four times.
If you need do to custom logic it may be better to use tsup or esbuild with tsc directly, instead of a preset.
I especially recommend playing with esbuild, it’s a very simple and useful tool to know.
Description
When using multiple entries in the preset options, the generated tsup configurations merge all entries into a single object, making it impossible to apply different configurations to different entries. An example of this would be
Current Behavior
When using multiple entries like this:
Using
preset.parsePresetOptions(options)
, yields me the following result:From the above, it looks like we get two outputs where one has DTS as
true
and the otherundefined
-- in other words, one is defined for types and the other is not.If say, I wanted to go ahead and add custom option configuration depending on the target name like so, I cannot do it:
Expected Behavior
Unless I'm missing something, each entry should generate its own build configuration, allowing for per-entry customization (or perhaps make this behavior configurable by adding some option to
tsup-preset-solid
to allow for it):Moreover on the above, after generating the tsup options via
preset.generateTsupOptions
, I would expect thename
value to be populated so that each one can be identified.Additional Context
The package.json exports are generated correctly with separate paths for each entry, but the build configurations don't maintain this separation.
Last Thoughts
Feel free to correct me if I have the wrong impression of how all of this is supposed to work. I'm still something of an "advanced beginner" when it comes to bundling and I may be suggesting something unhealthy here.
The text was updated successfully, but these errors were encountered: