How to have a separate package or common module within DUB?

monkyyy crazymonkyyy at gmail.com
Fri Dec 5 19:03:52 UTC 2025


On Friday, 5 December 2025 at 18:47:50 UTC, Ian wrote:
> Hi,
>
> Extremely basic question: I have a module that I want to share 
> between different DUB-based executables. How do I put this in a 
> different folder and point all the executables to share it? It 
> doesn't necessarily have to be a library at this point (though 
> that works too), as long as I can import the module.
>
>  Ian

dub was not made to do this and the docs remain: 
https://dub.pm/dub-reference/subpackages/ "unfinished" and will 
remain unfished

as far as I know adr's code is the futherest dub has been pushed 
*and he hates it*; 
https://github.com/adamdruppe/arsd/blob/master/dub.json when I 
followed his advice to not do that shit, it took 50 lines of code 
for my own build script. I bet ai can just do it in a single 
prompt by now.

You can make a "subpackage", copy someone elses file structure, 
but id suggest jumping ship if the json line count expands past 
50 and you run into a single piece of complexity no one has yet 
solved.


More information about the Digitalmars-d-learn mailing list