jihchi / vite-plugin-rescript Goto Github PK
View Code? Open in Web Editor NEWSeamlessly integrate ReScript with Vite
License: MIT License
Seamlessly integrate ReScript with Vite
License: MIT License
See announcement blog post for more details.
Hi, I'm trying to upgrade Vite to 3.0.1
and this plugin to 3.1.1
. When I try to start the dev server, Vite complains about a require()
in the plugin:
failed to load config from vite.config.js
error when starting dev server:
Error [ERR_REQUIRE_ESM]: require() of ES Module node_modules/@jihchi/vite-plugin-rescript/node_modules/execa/index.js
from node_modules/@jihchi/vite-plugin-rescript/dist/index.cjs not supported.
Instead change the require of index.js in node_modules/@jihchi/vite-plugin-rescript/dist/index.cjs to a dynamic import() which is available in all CommonJS modules.
at Object.require.extensions.<computed> [as .js] (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:62001:13)
...
error Command failed with exit code 1.
Is there something else I need to do to upgrade to Vite 3?
Thanks!
As the title says, I think it is more clean, furthermore build on demand is possible? What a interesting question ๐
const needReScript = (command === 'serve' && mode === 'development') || command === 'build';
mode
should be replaced by env.NODE_ENV
Hello, I encountered some problems when using vite3 and vite-plugin-rescript
These are the dependencies I currently use
That is, when import "main. res"
is used directly, vite's hot update does not take effect
After debugging the code, I found that the problem was caused by the use of the following options in the code
More a question than an issue per se.
I use in-source: false
to generate my JS files in a separate lib
folder. I wanted to use an image in my React code. I found in your template that you use @module
to import it like so:
@module("./logo.svg") external logo: string = "default"
but the generated JS code can't find it because it is not in the right folder anymore.
The documentation talks about a loader to solve that kind of issue, but I haven't really been able to understand how to make it work.
So how can I import an image in a .res
file and have the correct path for it in the generated JS file when it lives in a separate lib
folder?
Thanks a lot!
Hi!
I'm rewriting my hobby project from TS to ReScript and I'd like to say thank you for ReScript Real World App and vite-plugin-rescript!
It really helped to figure out some stuff.
When running vitest with coverage unit tests time out.
Note: the project where I encountered this bug had the tests written in typescript.
close timed out after 10000ms
Tests closed successfully but something prevents Vite server from exiting
You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters
test config:
test: {
globals: true,
environment: "jsdom",
coverage: {
reporter: ["json", "json-summary", "text"],
provider: "v8",
lines: 100,
statements: 100,
functions: 100,
},
},
Minimal reproduction: https://github.com/jderochervlk/rescript-vitest-plugin-bug
npm run test
createReScriptPlugin()
in vite.config.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.