From dc1ca21c3fab99efa24e12f6feb78b97138ea410 Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Fri, 27 Apr 2018 22:24:46 +0700 Subject: [PATCH] with-reasonml: better setup (#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. --- examples/with-reasonml/.gitignore | 1 + examples/with-reasonml/bsconfig.json | 6 +++++- examples/with-reasonml/next.config.js | 3 +++ examples/with-reasonml/package.json | 6 +++--- 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 examples/with-reasonml/next.config.js diff --git a/examples/with-reasonml/.gitignore b/examples/with-reasonml/.gitignore index 9d8f0bbe5193b..019f854e11a76 100644 --- a/examples/with-reasonml/.gitignore +++ b/examples/with-reasonml/.gitignore @@ -1,3 +1,4 @@ bs .merlin lib/ +*.bs.js diff --git a/examples/with-reasonml/bsconfig.json b/examples/with-reasonml/bsconfig.json index 30030a72ba2cd..66af768638c1e 100644 --- a/examples/with-reasonml/bsconfig.json +++ b/examples/with-reasonml/bsconfig.json @@ -3,7 +3,11 @@ "sources": ["components", "pages"], "bs-dependencies": ["reason-react", "bs-next"], "reason": { "react-jsx": 2 }, - "package-specs": ["commonjs"], + "package-specs": { + "module": "commonjs", + "in-source": true + }, + "suffix": ".bs.js", "bsc-flags": [ "-bs-super-errors" ], diff --git a/examples/with-reasonml/next.config.js b/examples/with-reasonml/next.config.js new file mode 100644 index 0000000000000..36556760d4afd --- /dev/null +++ b/examples/with-reasonml/next.config.js @@ -0,0 +1,3 @@ +module.exports = { + pageExtensions: ['jsx', 'js', 'bs.js'] +} diff --git a/examples/with-reasonml/package.json b/examples/with-reasonml/package.json index d28cf3612cb2c..4d5b35a99316d 100644 --- a/examples/with-reasonml/package.json +++ b/examples/with-reasonml/package.json @@ -2,9 +2,9 @@ "name": "with-reasonml", "version": "1.0.0", "scripts": { - "dev": "bsb -clean-world -make-world && next dev lib/js", - "build": "bsb -clean-world -make-world && next build lib/js", - "start": "next start lib/js" + "dev": "concurrently \"bsb -clean-world -make-world -w\" \"next dev\"", + "build": "bsb -clean-world -make-world && next build", + "start": "next start" }, "license": "ISC", "dependencies": {