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
In order to use the same module as a library and make it runnable, it seems that modules that define a main of the right type should have a wrapper module generated with package main and a library module with the normal module path name. The main module can simply import the library package and call the main function in the package, so that the main function is still visible to consumers of the library as a normal main as it is in purescript js.
A workaround for this is to define multiple spago projects as described here https://github.com/purescript/spago#monorepo, one with the shared code, and one for each binary. This mirrors go's restriction of having one main per folder.
The text was updated successfully, but these errors were encountered:
When providing an argument to the
-m
flag to spago run such asspago run -m Parser
, I get following errorThis seems to do with how the module name "Main" is reserved https://github.com/andyarvanitis/purescript-native/pull/60/files#diff-bbb636505a367cfa1f620353cba3c3e3R452. Main is compiled in
package main
, while libraries intended to be imported and not run are compiled with a package named after the module path.In order to use the same module as a library and make it runnable, it seems that modules that define a main of the right type should have a wrapper module generated with
package main
and a library module with the normal module path name. The main module can simply import the library package and call the main function in the package, so that the main function is still visible to consumers of the library as a normal main as it is in purescript js.A workaround for this is to define multiple spago projects as described here https://github.com/purescript/spago#monorepo, one with the shared code, and one for each binary. This mirrors go's restriction of having one main per folder.
The text was updated successfully, but these errors were encountered: