- Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Issue
The package ships with only ReScript source files (.res, .resi) but no compiled JavaScript output (.bs.js files). The bsconfig.json is missing the package-specs configuration needed to generate compiled files.
Environment
- Package version: 1.4.0
- Build tool: Rspack 1.5.8 / Webpack 5
- ReScript: 11.1.4
Problem
When trying to use this package in a project, imports fail with:
Module not found: Can't resolve '@glennsl/rescript-json-combinators/src/Json.bs.js' This happens because:
- The ReScript compiler generates imports like:
import * as Json from "@glennsl/rescript-json-combinators/src/Json.bs.js" - But the package only includes
.resfiles in the published npm package - The package's
bsconfig.jsondoesn't includepackage-specs, so.bs.jsfiles aren't generated
Current bsconfig.json
{ "name": "@glennsl/rescript-json-combinators", "namespace": "JsonCombinators", "sources": [ "src", { "dir": "examples", "type": "dev" } ] }Proposed Fix
Add package-specs and suffix to bsconfig.json:
{ "name": "@glennsl/rescript-json-combinators", "namespace": "JsonCombinators", "sources": ["src"], "package-specs": [ { "module": "esmodule", "in-source": true } ], "suffix": ".bs.js" }Also remove the examples directory reference since it doesn't exist in the published package.
Workaround
Currently using patch-package to apply this fix:
# patches/@glennsl+rescript-json-combinators+1.4.0.patchQuestions
- Is the intent to ship only source files and have consumers compile them?
- If so, should this be documented in the README?
- Or is this an oversight in the build/publish configuration?
Impact
This makes it difficult to use the package with modern bundlers (Webpack, Rspack, Vite) without manual patching.
References
- Similar issue pattern in other ReScript packages
- Standard practice is to either ship compiled files OR document the in-source build requirement
Metadata
Metadata
Assignees
Labels
No labels