-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Main entry point support #33
Comments
Thanks for checking out the |
This does in fact work. See: ethul/purescript-webpack-example@923f3c1 |
@ethul I just tried building https://github.com/ethul/purescript-webpack-example but it didn't work:
Notice that it does not call anything, therefore it does nothing when running The point of this issue is to automatically call the |
Agreed. You're totally correct. I was too soon on closing this. I've been updating the example further. Please see: https://github.com/ethul/purescript-webpack-example/blob/30265626f89b605bf24be94a8f7fadd2610bcd23/src/Example.purs#L17-L25 |
@ethul With I think |
@ethul Hm, actually, I thought about it some more. Webpack supports multiple entry points, so you would really want to be able to specify a different If you only have a single entry point, you can currently use the following to specify the
|
Right. So you can return an Maybe the loader could create a wrapper entry module that invokes this function. Supporting a main for each entry could maybe be done in a similar way if the loader was able to know which modules are "entry modules" then it can wrap each of the entries, and we'd need a configuration that we can lookup the right main function using the module name (as one idea). E.g., {
moduleMainFunctions: {
'ExampleEntry1': 'example1',
'ExampleEntry2': 'example2'
}
} |
I notice in your example webpack config you have
{ entry: './src/entry' }
, which is a JS file thatrequire
s any PureScript modules that you need.In my case, I just want to call Main.main, so mine looks like this:
require('./Main.purs').main();
It seems like it would be cleaner if you could just use{ entry: './src/Main.purs' }
directly.I believe the browserify/psc-bundle toolchain does something like this already. Would you consider adding it to purs-loader? I'm fairly new to PureScript, but happy to do the lifting with a bit of direction. (Though maybe #31 would make this irrelevant anyway.)
The text was updated successfully, but these errors were encountered: