Skip to content

Commit 6158243

Browse files
rase-timneutkens
authored andcommitted
with-reasonml: better setup (vercel#4218)
With this setup we're compiling the .re/.ml files directly to source directories with a .bs.js extension, and enabling next.js to pick up that extension for pages.
1 parent f378448 commit 6158243

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

examples/with-reasonml/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bs
22
.merlin
33
lib/
4+
*.bs.js

examples/with-reasonml/bsconfig.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
"sources": ["components", "pages"],
44
"bs-dependencies": ["reason-react", "bs-next"],
55
"reason": { "react-jsx": 2 },
6-
"package-specs": ["commonjs"],
6+
"package-specs": {
7+
"module": "commonjs",
8+
"in-source": true
9+
},
10+
"suffix": ".bs.js",
711
"bsc-flags": [
812
"-bs-super-errors"
913
],

examples/with-reasonml/next.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
pageExtensions: ['jsx', 'js', 'bs.js']
3+
}

examples/with-reasonml/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "with-reasonml",
33
"version": "1.0.0",
44
"scripts": {
5-
"dev": "bsb -clean-world -make-world && next dev lib/js",
6-
"build": "bsb -clean-world -make-world && next build lib/js",
7-
"start": "next start lib/js"
5+
"dev": "concurrently \"bsb -clean-world -make-world -w\" \"next dev\"",
6+
"build": "bsb -clean-world -make-world && next build",
7+
"start": "next start"
88
},
99
"license": "ISC",
1010
"dependencies": {

0 commit comments

Comments
 (0)