Add a task for fast builds with `purs ide` & webpack
parent
0ff25e5ad5
commit
cbe2fe0657
22
README.md
22
README.md
|
@ -1,7 +1,5 @@
|
||||||
# purescript-halogen-template
|
# purescript-halogen-template
|
||||||
|
|
||||||
[![Dependency status](https://img.shields.io/librariesio/github/slamdata/purescript-halogen-template.svg)](https://libraries.io/github/slamdata/purescript-halogen-template)
|
|
||||||
|
|
||||||
This is a template for starting a fresh project using the [purescript-halogen](https://github.com/slamdata/purescript-halogen) library for declarative user interfaces.
|
This is a template for starting a fresh project using the [purescript-halogen](https://github.com/slamdata/purescript-halogen) library for declarative user interfaces.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
@ -53,4 +51,22 @@ pulp build --to dist/app.js
|
||||||
|
|
||||||
If you open `dist/index.html` you should now have a basic working Halogen app.
|
If you open `dist/index.html` you should now have a basic working Halogen app.
|
||||||
|
|
||||||
That's pretty much it. Have fun with Halogen!
|
You can also use the command:
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
npm run watch
|
||||||
|
```
|
||||||
|
|
||||||
|
To start a process that will watch the source files and trigger a reload whenever they are modified. Alternatively...
|
||||||
|
|
||||||
|
## Fast watching with `purs ide`
|
||||||
|
|
||||||
|
If you're using an editor that supports `purs ide` or running [`pscid`](https://github.com/kRITZCREEK/pscid) there's an option for getting near-instant builds of the app while you work on it:
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
npm run watch-fast
|
||||||
|
```
|
||||||
|
|
||||||
|
This will start a watch process that uses [Webpack](https://github.com/webpack/webpack) to rebundle the app whenever the _output_ files are changed. Since `purs ide` rebuilds modules on save, this means you can use this much faster bundle-only rebuild script.
|
||||||
|
|
||||||
|
:warning: `purs ide` only rebuilds one module at a time, so sometimes the bundle will end up in an inconsistent state, resulting in runtime errors. This occurs when a change is made in one module that breaks other modules that depend on it. The solution is to run a full build when a change like this is made, as the compiler will force you to resolve those errors.
|
||||||
|
|
10
package.json
10
package.json
|
@ -2,11 +2,13 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pulp build --to dist/app.js",
|
"build": "pulp build --to dist/app.js",
|
||||||
"watch": "pulp -w build --to dist/app.js"
|
"watch": "pulp -w build --to dist/app.js",
|
||||||
|
"watch-fast": "webpack --entry ./entry.js --output-filename dist/app.js --progress --watch"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"pulp": "^11.0.0",
|
"pulp": "^12.0.1",
|
||||||
"purescript": "^0.11.0",
|
"purescript": "^0.11.6",
|
||||||
"purescript-psa": "^0.5.0"
|
"purescript-psa": "^0.5.1",
|
||||||
|
"webpack": "^3.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue