Skip to content

Conversation

@f-f
Copy link
Member

@f-f f-f commented Jan 22, 2026

Fix #181 (at last!!) by following my own suggestion from here

@f-f f-f requested a review from fsoikin January 22, 2026 08:17
Copy link
Collaborator

@fsoikin fsoikin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, but here's a suggestion: since we're already parsing the module, how about also checking that the main's type is Effect Unit? It's true that the type could be aliased and not look like Effect Unit, but I think it's a reasonable requirement to have the entry point typed exactly like that. Or, alternatively, it could be a warning. Or can be disabled with a switch.

, "Add `main` to the module's export list, remove the explicit export list, or use --bundle-type=module."
]
EntryPoint.ParseError err ->
logWarn $ "Could not verify main export: " <> err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also be an error? If the module failed to parse, surely we can't bundle, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I just downgraded this to a debug log - the point where we run this is right after a build, so we know that the code compiles; if there's a parse error then the issue must be somewhere else and it's not worth warning the user about it (but still useful to report a debug log in case this is wrong and we need to trace it 🙂)

@f-f
Copy link
Member Author

f-f commented Jan 22, 2026

@fsoikin makes sense, I added detection for the Effect Unit type as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spago does not emit an error when bundling an app's main module that does not have a main function

3 participants