Skip to content

Use iife when bundling browser apps #880

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

Merged

Conversation

sigma-andex
Copy link
Contributor

Description of the change

TODO

Checklist:

  • Added the change to the "Unreleased" section of the changelog
  • Added some example of the new feature to the README
  • Added a test for the contribution (if applicable)

P.S.: the above checks are not compulsory to get a change merged, so you may skip them. However, taking care of them will result in less work for the maintainers and will be much appreciated 😊

@CarstenKoenig
Copy link

Not sure how other folks like to use this but I like to add the global name option to wrap the exports into an object.
I think this is very close to the way purescript was bundled before and it's really helpful for me when I like to call main with arguments (a bit like Elm does with flags) or when I want to expose other functions/entry points into the app.

Maybe we could add a flag to use --global-name=PS or even let users choose the name?

@sigma-andex
Copy link
Contributor Author

sigma-andex commented May 1, 2022

We had some discussions about the esbuild in the working group and I think the consent was that we didn't want to wrap the whole esbuild params list but just the basic parameters. I think a flag to add any additional esbuild params like --purs-args would make sense, but I guess that deserves a different issue/pr then.

@CarstenKoenig
Copy link

Ok I guess users can opt to directly use esbuild in this case - still very much appreciate this PR as it would get rid of an bug/error I had when using spago bundle-app without --minify when something exports document ❤️

@f-f f-f merged commit 9a6a628 into purescript:master May 2, 2022
@sigma-andex sigma-andex deleted the use-iife-for-browser-apps branch May 2, 2022 11:38
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.

3 participants