Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.

Document "import" warning in Unified module #412

Merged
5 commits merged into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/master/docs/docson/build-schema.json",
"$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/9.0.0/docs/docson/build-schema.json",
"name": "ocamlorg",
"namespace": true,
"reason": {
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
"next:debug": "NODE_OPTIONS='--inspect' next dev",
"watch": "concurrently --raw \"bsb -make-world -w\" \"next dev\" ",
"watch-and-serve": "concurrently --raw \"bsb -make-world -w\" \"next dev\" \"http-server out\"",
"build": "bsb -clean-world -make-world && next build && next export",
"start-test-server": "http-server out"
"build": "bsb -clean-world -make-world && next build && next export && yarn total-dependencies-check",
"start-test-server": "http-server out",
"total-dependencies-check": "(test $(grep '^[a-zA-Z@].*:$' yarn.lock | wc -l) -lt 500 && echo ok) || (echo too many deps && exit 1) "
},
"scriptsDescription": {
"build": "at present, next export is only used to ensure that we strictly use static site functionality",
"start-test-server": "Vercel deployments use next start, but this command tests running a pure static site. TODO: use npx from Makefile instead."
"build": "At present, next export is only used to ensure that we strictly use static site functionality.",
"start-test-server": "Vercel deployments use next start, but this command tests running a pure static site. TODO: use npx from Makefile instead.",
"total-dependencies-check": "Test, approximately, whether the current transitiive dependencies has grown significantly."
},
"devDependencies": {
"@tailwindcss/typography": "^0.4.0",
Expand Down
13 changes: 13 additions & 0 deletions src/Unified.res
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// The following code causes a warning. My limited understanding is that the warning
// occurs because there is a mismatch between ReScript's assumptions about the version
// of Javascript being used and the actual version of Javascript used in NextJS. Currently,
// we have ReScript configured to target the ES6 version of Javascript. This is the emerging standard. At the same time,
// there are open issues in NextJS requesting ES6 support, but NextJS does not
// currently evaluate Javascript in an ES6 context. NextJS uses CommonJS when
// evaluating Javascript. The warning occurs because ReScript uses an external validator
// on the generated Javascript and the external validator notes that using "import" in
// the syntax below is not valid in ES6. The syntax is valid in CommonJS, which means
// the code will successfully run in NextJS.
// This warning will hopefully be resolved by September of 2021, if
// NextJS proceeds to lift its restriction on using ES6. The status of this issue
// can be tracked in Github issue #298.
%%raw(`
const MdastUtilToStringInternal = (await import('mdast-util-to-string')).toString
`)
Expand Down