I have a project that depends on three other packages I maintain. The problem that I’m facing is that while compiling on a clean environment (Dockerfile, for instance), the compiler states that the version of the compiler changes and performs a clean up, but then other packages fail to find the already compile package.
This is a typical output:
Dependency on @kaiko.io/rescript-prelude
Different compiler version: clean current repo
Cleaning... 6 files.
rescript: [1/3] src/Prelude.ast
rescript: [2/3] src/Prelude.d
rescript: [3/3] src/Prelude.cmj
rescript: [1/5] Prelude.cmi
rescript: [2/5] Prelude.cmj
rescript: [3/5] Prelude.cmt
rescript: [4/5] Prelude.res
rescript: [5/5] install.stamp
Dependency on @kaiko.io/rescript-deser
Different compiler version: clean current repo
Cleaning... 5 files.
Cleaning... 18 files.
rescript: [1/3] src/JSON.ast
rescript: [2/3] src/JSON.d
rescript: [3/3] src/JSON.cmj
FAILED: src/JSON.cmj
We've found a bug for you!
.../frontend/node_modules/@kaiko.io/rescript-deser/src/JSON.res:2:6-12
1 │ @@uncurried
2 │ open Prelude
3 │
4 │ module FieldValue = {
The module or file Prelude can't be found.
- If it's a third-party dependency:
- Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in bsconfig.json?
- Did you include the file's directory to the "sources" in bsconfig.json?
If I retry the compilation at this moment it will pass this point, and then fail in the next dependency:
Dependency on @kaiko.io/rescript-prelude
rescript: [1/3] src/Prelude.ast
rescript: [2/3] src/Prelude.d
rescript: [3/3] src/Prelude.cmj
rescript: [1/5] Prelude.cmi
rescript: [2/5] Prelude.cmj
rescript: [3/5] Prelude.res
rescript: [4/5] Prelude.cmt
rescript: [5/5] install.stamp
Dependency on @kaiko.io/rescript-deser
rescript: [1/1] src/JSON.cmj
rescript: [1/5] JSON.cmi
rescript: [2/5] JSON.cmj
rescript: [3/5] JSON.cmt
rescript: [4/5] JSON.res
rescript: [5/5] install.stamp
Dependency on @kaiko.io/rescript-reindexed
Different compiler version: clean current repo
Cleaning... 5 files.
Cleaning... 168 files.
rescript: [1/78] src/IDB/IDB__VersionChangeEvent.ast
rescript: [2/78] src/IDB/Migration/IDB__Migration__Utils.ast
rescript: [3/78] src/IDB/Migration/IDB__Migration__Store.ast
...
FAILED: src/ReIndexedPatterns.cmj
We've found a bug for you!
...frontend/node_modules/@kaiko.io/rescript-reindexed/src/ReIndexedPatterns.res:11:6-12
9 │
10 │ ")
11 │ open Prelude
12 │ include ReIndexedCommands
13 │
The module or file Prelude can't be found.
- If it's a third-party dependency:
- Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in bsconfig.json?
- Did you include the file's directory to the "sources" in bsconfig.json?
Another retry and the compilation succeeds. This happens every time I update one those packages.
I really don’t know why the compiler claims a version change. My main packages has the following deps (fragment):
{
"name": "app",
"private": true,
"type": "module",
"dependencies": {
"@kaiko.io/rescript-deser": "4.0.0",
"@kaiko.io/rescript-prelude": "7.0.0",
"@kaiko.io/rescript-reindexed": "6.0.1"
},
"devDependencies": {
"rescript": "11.0",
"@rescript/tools": "^0.4.0",
"vite": "^4.4.9",
"vite-plugin-compression": "^0.5.1",
"@jihchi/vite-plugin-rescript": "^5.5.0"
}
}
The package @kaiko.io/rescript-prelude
has no other dependency besides rescript itself. Its current package.json
is:
{
"name": "@kaiko.io/rescript-prelude",
"version": "7.0.0",
"description": "Prelude.res",
"files": [
"src",
"lib",
"README.md",
"CHANGELOG.md",
"rescript.json"
],
"devDependencies": {
"rescript": "11.0"
}
}
And it’s rescript.json
is
{
"name": "@kaiko.io/rescript-prelude",
"sources": [
{
"dir": "src",
"subdirs": true
}
],
"suffix": ".js",
"reason": {
"react-jsx": 3
},
"uncurried": true,
"bs-dependencies": [],
"package-specs": [
{
"module": "es6"
},
{
"module": "commonjs"
}
]
}
On the other hand, the packages @kaiko.io/rescript-deser
, and @kaiko.io/rescript-reindexed
both depend on @kaiko.io/rescript-prelude
(version 7.0.0).
The package.json
for deser is:
{
"name": "@kaiko.io/rescript-deser",
"version": "4.0.0",
"keywords": [
"json",
"deserializer",
"rescript"
],
"description": "Simple JSON deserializer for ReScript",
"repository": "https://gitlab.com/kaiko-systems/rescript-deser",
"author": "Kaiko Systems <info@kaikosystems.com>",
"license": "MIT",
"private": false,
"files": [
"lib",
"src",
"tests",
"www",
"rescript.json",
"README.md"
],
"dependencies": {
"@kaiko.io/rescript-prelude": "7.0.0"
},
"devDependencies": {
"esbuild": "^0.15.7",
"qunit": "^2.16.0",
"rescript": "11.0."
}
}
Its rescript.json
is:
{
"name": "@kaiko.io/rescript-deser",
"sources": [
{
"dir": "src/",
"subdirs": true
},
{
"dir": "tests",
"type": "dev"
}
],
"suffix": ".js",
"bs-dependencies": [
"@kaiko.io/rescript-prelude"
],
"uncurried": true,
"package-specs": [
{
"module": "es6"
},
{
"module": "commonjs"
}
],
"warnings": {
"error": "+8+11+26+27+33+56"
}
}
The package.json
of the @kaiko.io/rescript-reindexed
is
{
"name": "@kaiko.io/rescript-reindexed",
"version": "6.0.1",
"license": "MIT",
"devDependencies": {
"@jihchi/vite-plugin-rescript": "^5.3.0",
"qunit": "^2.16.0",
"rescript": "11.0",
"vite": "^4.2.0"
},
"dependencies": {
"@kaiko.io/rescript-prelude": "7.0.0"
},
"description": "Kind of an IndexedDB ORM written in ReScript with no runtime dependencies.",
"author": "Kaiko Systems GmbH",
"repository": "https://gitlab.com/kaiko-systems/ReIndexed",
"keywords": [
"rescript",
"indexedDB",
"idb",
"orm"
],
"files": [
"src",
"tests",
"lib",
"README.md",
"index.html",
"vite.config.js",
"Makefile",
"rescript.json"
]
}
Its rescript.json
is:
{
"name": "@kaiko.io/rescript-reindexed",
"sources": [
{
"dir": "src",
"subdirs": true
},
{
"dir": "tests",
"type": "dev"
}
],
"uncurried": true,
"bs-dependencies": [
"@kaiko.io/rescript-prelude"
],
"package-specs": [
{
"module": "es6"
},
{
"module": "commonjs"
}
],
"warnings": {
"error": "+8+11+26+27+33+56"
}
}