Skip to content

[psc-bundle] Verify entry points exist#2286

Merged
paf31 merged 3 commits intopurescript:masterfrom
kritzcreek:bundle-report-missing-entry
Aug 26, 2016
Merged

[psc-bundle] Verify entry points exist#2286
paf31 merged 3 commits intopurescript:masterfrom
kritzcreek:bundle-report-missing-entry

Conversation

@kritzcreek
Copy link
Copy Markdown
Member

Throws an error when an entry point could not be found in the input
modules.

Fixes #1755

I've checked for all the entry points instead of the passed --main module here. I'm happy to change that, but it seemed like the more sensible choice to me.

Throws an error when an entry point could not be found in the input
modules.
@kritzcreek kritzcreek force-pushed the bundle-report-missing-entry branch from 92d7c13 to 40e9fec Compare August 24, 2016 14:45
@hdgarrood
Copy link
Copy Markdown
Contributor

Does this address the case where --main is specified but not --module?

@kritzcreek
Copy link
Copy Markdown
Member Author

Could you elaborate? What command should I try? I'm not all that familiar with psc-bundle

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Aug 25, 2016

I think @hdgarrood is saying that mainModule also needs to be in the list of parsed modules. So something like psc-bundle *.purs --main This.Does.Not.Exist.

@hdgarrood
Copy link
Copy Markdown
Contributor

Right, exactly. Also I'm a bit surprised it's necessary to check entry points, come to think of it. What happens with 0.9.3 if you specify a nonexistent entry point with ‘--module`?

(Also 'entry point' doesn't quite feel right; is that what we usually refer to modules specified with the --module flag as?)

@kritzcreek
Copy link
Copy Markdown
Member Author

Does this address the case where --main is specified but not --module?

psc-bundle output/**/*.js --main Main doesn't perform any DCE, but it bundles all the found modules and adds a PS["Main"].main(); to the end of the file. For a non-existing module like Mai it adds PS["Mai"].main(); to the end of the file, so that should probably also be checked.

Right, exactly. Also I'm a bit surprised it's necessary to check entry points, come to think of it. What happens with 0.9.3 if you specify a nonexistent entry point with ‘--module`?

This originally came up because someone on IRC copied an example file to Main.purs but didn't change the module header so it still said Test.Main. When he then ran pulp build --to example.js, he got an empty bundle that called out to the non-existent Main module. I'm not sure what flags pulp passes on to psc-bundle, but it throws the right error after applying this patch.

(Also 'entry point' doesn't quite feel right; is that what we usually refer to modules specified with the --module flag as?)

At least in the README for psc-bundle we do https://github.com/purescript/purescript/tree/master/psc-bundle#usage.

@hdgarrood
Copy link
Copy Markdown
Contributor

Ah great, thanks for answering my questions! In that case this looks great, +1: to merge. The wording issue with 'entry point' isn't a big deal and can be addressed separately anyway (if it needs addressing at all).

@paf31 paf31 merged commit df85f5c into purescript:master Aug 26, 2016
@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Aug 26, 2016

Thanks!

@kritzcreek kritzcreek deleted the bundle-report-missing-entry branch August 26, 2016 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants