Skip to content

Commit 21451b2

Browse files
committed
Using purs-backend-es for production bundling
1 parent db4cc73 commit 21451b2

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ node_modules
1818
*.log
1919

2020
# Generated
21-
dce-output
2221
dist
2322
generated-docs
2423
output
24+
output-es
2525
serve

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
import { main } from "./output/Main";
2-
3-
main();
1+
if (process.env.NODE_ENV == "production") {
2+
require("/output-es/Main").main();
3+
} else {
4+
require("/output/Main").main();
5+
}

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "purescript-react-realworld",
3-
"version": "4.0.1",
3+
"version": "4.1.0",
44
"description": "A real-world application demonstrating PureScript and React",
55
"keywords": [
66
"Purescript",
@@ -20,8 +20,8 @@
2020
"license": "MIT",
2121
"scripts": {
2222
"build": "spago build",
23-
"bundle": "spago build && parcel build index.html --no-source-maps",
24-
"clean": "rm -Rf .cache dist serve output dce-output node_modules .spago *.lock",
23+
"bundle": "spago -x spago.production.dhall build && parcel build index.html --no-source-maps",
24+
"clean": "rm -Rf .cache dist serve output output-es node_modules .spago *.lock",
2525
"postinstall": "spago install",
2626
"serve": "yarn build && yarn serve:parcel",
2727
"serve:parcel": "parcel serve --no-source-maps --dist-dir serve index.html",
@@ -31,6 +31,7 @@
3131
"parcel": "2.0.0",
3232
"purescript": "^0.15.4",
3333
"purescript-psa": "^0.8.2",
34+
"purs-backend-es": "^1.1.0",
3435
"purs-tidy": "^0.9.2",
3536
"spago": "^0.20.9"
3637
},

spago.production.dhall

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./spago.dhall // { backend = "purs-backend-es build" }

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,6 +2304,11 @@ purescript@^0.15.4:
23042304
dependencies:
23052305
purescript-installer "^0.2.6"
23062306

2307+
purs-backend-es@^1.1.0:
2308+
version "1.1.0"
2309+
resolved "https://registry.yarnpkg.com/purs-backend-es/-/purs-backend-es-1.1.0.tgz#55c78280a8ae572792e5b0876a09b1c998dadb53"
2310+
integrity sha512-AC7OLAAmGyslvNriOOE6BaEDoG3UKsT2Pw2P72R2DLhn7yiAsRNH60/1e+Huj29Vyn2ClWaY7TEQAu7AFclqGQ==
2311+
23072312
purs-tidy@^0.9.2:
23082313
version "0.9.2"
23092314
resolved "https://registry.yarnpkg.com/purs-tidy/-/purs-tidy-0.9.2.tgz#b67e4a18ee3125edb4562cd5e3244dafe747cfdd"

0 commit comments

Comments
 (0)