0

Following PureScript by Example, I'm using pulp for installing packages.

Halogen requires virtual-dom as extra dependency. From the documentation and the example packages, it seems to me that adding it involves a bunch of build tools that I haven't used before (gulp, webpack, bower, etc.). I downloaded the examples and tried to run them with npm install & npm run example but I got unknwon module errors.

So, I'd like to know a minimal viable way to install halogen into a new pulp project (which hopefully doesn't require me to delve into the slew of build tools, or at least not for small projects).

András Kovács
  • 29,931
  • 3
  • 53
  • 99

1 Answers1

1

I think you should be able to build it with pulp browserify --to some-file.js - the Browserify option is there for situations like this, where you want to produce a single JS file from a collection of CommonJS modules that may include npm dependencies.

gb.
  • 4,629
  • 1
  • 20
  • 19
  • What's the sequence of steps, after `pulp init`, which results in me being able to run (`pulp run`) my program that imports halogen? – András Kovács Dec 13 '15 at 13:32
  • I don't think you ever want to `pulp run` this - it's for running things in `node` directly - not so useful for a front-end web app! `pulp server` might be more useful however, as that will watch your source files and run a local development server on http://localhost:1337/. It'll incorporate the `virtual-dom` dependency also. – gb. Dec 13 '15 at 14:19
  • Thanks, I did `browserify` and included the output in a html file, and it worked. Could you also tell me how to use `pulp build`? I tried it the same way, but it couldn't find `require` at first, then after I included `require.js` it couldn't load `virtual-dom`. – András Kovács Dec 13 '15 at 15:32
  • How can I use `pulp server`? It just displays a directory tree for me on localhost, or views `index.html` in the project directory, but doesn't reload or recompile anything if I change my sources. – András Kovács Dec 13 '15 at 15:57
  • Sorry I didn't see these until now, glad you got it figured out! The [PureScript IRC channel](http://webchat.freenode.net/?channels=purescript) may be able to help you out in a timely fashion if you run into problems like this again. – gb. Dec 14 '15 at 14:45