-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@rescript/core package doesn't have the javascript file #6754
Comments
rescript-core only ships with mjs files. You could try to change your rescript.json to {
...
"package-specs": [
{
- "module": "commonjs",
+ "module": "esmodule",
"in-source": true
}
],
- "module": ".res.js",
+ "module": ".res.mjs",
...
} |
@fhammerschmidt Thanks, using
Using
Re-running
Finally, it seems like
|
Also switching to
Note that this happens with a regular cra |
Ok sorry about the noise, but if I understand correctly, create-react-app does not support mjs files out of the box according to facebook/create-react-app#10356 . It would be better if we don't have to update downstream build script just for that. Would it be possible to publish the javascript version of the std libs so that we can upgrade to rescript seamlessly? |
Ah yes, just Sorry, I guess you need to still ship the whole runtime for now since ReScriptCore did not really take into account that feature yet. It will be seamlessly when Core is part of the compiler. Also, just a recommendation: Consider switching to vite, it's so much better and easier to maintain than create-react-app and esmodule should be the default over commonjs already IMO. And when you use esmodule your end-users should be able to tree-shake all unused code away. |
Well I'm not familiar with react/vite/next, and my issue is that using It looks like // In config-overrides.js add:
function supportMJS(config) {
config.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
});
return config;
}
const { override } = require("customize-cra");
module.exports = override(supportMJS, rewiredEsbuild()); That will do, thanks for the explanation @fhammerschmidt . |
Don't you still have this issue?
|
No, this is gone after adding |
On second thought, you should really really use a bundler for publishing the library as well. And I suggest we mention that on the rescript-std page on rescript-lang.org but I will do that myself. |
Sounds great to me, thanks for your help! |
Hello folks,
I'm trying to update one of my package (repo) from bs-platform 8.2 to rescript 11, and I get the following error when importing it in a regular javascript project:
According to https://rescript-lang.org/docs/manual/latest/build-external-stdlib we need to use
@rescript/std
, and even though that removes the requirements fromrescript
, some modules from@rescript/core
are not readily available as JavaScript. Is there something I am missing?Thanks in advance,
-Tristan
The text was updated successfully, but these errors were encountered: