GithubHelp home page GithubHelp logo

jihchi / vite-plugin-rescript Goto Github PK

View Code? Open in Web Editor NEW
87.0 3.0 10.0 1.03 MB

Seamlessly integrate ReScript with Vite

License: MIT License

TypeScript 100.00%
vite-plugin rollup-plugin rescript rescript-react

vite-plugin-rescript's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vite-plugin-rescript's Issues

How to upgrade to Vite 3? Vite errors due to this plugin

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!

about modes

  • Can I use vite-plubin-rescript with custom mode ?
  • I find this code const needReScript = (command === 'serve' && mode === 'development') || command === 'build';
  • I think that mode should be replaced by env.NODE_ENV

When `import "main. res"` is used, vite's hot update does not take effect

Hello, I encountered some problems when using vite3 and vite-plugin-rescript
These are the dependencies I currently use
image

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
image

Import an image when `in-source: false`

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!

Thank you!

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.

Unit tests time out when running coverage

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

  • Unit tests are written in TypeScript to test files compiled by ReScript
  • To see error run npm run test
  • To remove the error comment out createReScriptPlugin() in vite.config.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.