How to change the path for Spago to look for Purescript's library to bundle?

I have changed the build path for my Purescript’s modules with this cmd:

spago build --purs-args '-o /src/purescript'; 

Now I want spago to look for content from this folder instead of output when I bundle a module. How can I do that?

The cmd I use for bundling:

spago bundle-module --main Helper --to src/utilities/helper.js;

I tried a lot of stuff, but couldn’t find a solution. Do you have a particular reason that you’re using src/purescript instead of the default?

Actually, I just found a way to do it, but not with Spago, but by using the PureScript compiler directly:

purs bundle src/purescript/**/*.js --main Helper --to src/utilities/helper.js
echo ";module.exports=PS.Helper;" >> src/utilities/helper.js

You have to have already built the modules using spago build as you did.

I am experimenting the compiler so that I can integrate Purescript into different projects I have in hand. The documentation of Spago is still relatively thin.

I will try this tonight. Thank you!

1 Like

Is changing the output path necessary for that? Can you elaborate?

Would you have any recommendations on what we could improve in the docs to make this information more available?
As @mhmdanas noted it would be of great help to clarify your original usecase, as “changing the output directory” might not be necessary and there might be a simpler way to achieve what you need.