Skip to content
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

Add a "getting started with Parcel" to docs #456

Closed
f-f opened this issue Oct 14, 2019 · 10 comments
Closed

Add a "getting started with Parcel" to docs #456

f-f opened this issue Oct 14, 2019 · 10 comments

Comments

@f-f
Copy link
Member

f-f commented Oct 14, 2019

We have a "getting started" guide in the docs, but that's quite minimal. Leon on Slack noted how we could have a slightly more detailed "getting started with Parcel" to show how one could get a JS project to build with Spago + Parcel:

i guess what i was actively searching in the Spago Readme was some chapter "Getting started: Simple development Setup with Parcel" or something, that explains a typical workflow

  • compile code using spago build into output/Main/index.js
  • create index.html in project root and load an index.js file
  • create index.js, require the compiled purescript file in there and call the main method of it
  • call parcel index.html to start the dev-server

or something simmilar. the big problem for me was that I'm rather new to Puresript and not that experienced with the JS build ecosystem as well (Parcel, etc), so things like "most of the time, you'll have some kind of index.html, that does some stuff, where you can then import the Purescript File and call main " dont really make it clear what to do when just trying to set up a simple project and get started.
it all makes sense as soon as you understand how the things connect with one another, but as long as you don't, the instructions are rather unclear. maybe a beginners-guide or something that talks about the most common setups and gives examples would be great. maybe having a live-server directly integrated into spago would be great as well

@Benjmhart
Copy link
Contributor

I'll take a run at this one since I've set up projects to do this

@swuecho
Copy link
Contributor

swuecho commented Oct 21, 2019

and webpack?

trying to use the generated index.js with webpack, leading to "Cannot assign to read only property 'exports' of object '#'"

@Benjmhart
Copy link
Contributor

Benjmhart commented Oct 21, 2019

@swuecho - currently the guide is for parcel, however I might have some time to add steps to configure for webpack and nodemon (for server-side projects) at some point.

@f-f
Copy link
Member Author

f-f commented Oct 26, 2019

Fixed in #461

@f-f f-f closed this as completed Oct 26, 2019
@Benjmhart
Copy link
Contributor

@f-f Actually I think I'll add a guide for nodemon and (possibly) webpack as well. I'll see if I can get a PR up in a reasonable amount of time.

@swuecho
Copy link
Contributor

swuecho commented Oct 27, 2019

@Benjmhart purescript/purescript#3613 the module format make it not so easy to work with webpack.

@Benjmhart
Copy link
Contributor

@swuecho - I'm writing webpack docs today. if you can work with parcel you can work with webpack.

@Benjmhart
Copy link
Contributor

@swuecho - there is a PR up relating to your request:#473

you can also look at the docs in my fork to see how to get a webpack development server up and running with Spago and Purescript: https://github.com/Benjmhart/spago

@swuecho
Copy link
Contributor

swuecho commented Oct 28, 2019

@Benjmhart Thanks. I did not know there is purs-loader out there. after I copied the loader in my webpack config, works greet.

I was expected that I can import the js output directly in js code.

@Benjmhart
Copy link
Contributor

@swuecho - you can definitely use a webpack in the way you describe, with spago producing an output in js and webpack bundling the JS as a dependancy, however webpack should really be your end-to-end development bundler, with spago being used more for managing dependancies in that workflow.

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

No branches or pull requests

3 participants