From 61582433396ca41c4a411b511d90e528d80f8998 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 9d8f0bbe..019f854e 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 30030a72..66af7686 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 00000000..36556760 --- /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 d28cf361..4d5b35a9 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": {