Following up on the recent ReScript 9.1.2 release, I updated my rescript-nextjs-template to the latest Next & ReScript version.
It now comes with Webpack 5 and ES6 compilation enabled by default. The changes are running on rescript-lang.org as well, so it has proven to be stable.
Thanks to @jorge / @kanishka for kicking off the discussion to fix some weird node_modules / ES6 module related issues.
Very cool, thanks!
Is it better to run next and rescript in different tabs or concurrently? I have been using concurrent so I’m curious about your approach
I have been thinking lately that I wish next build was fast enough where I could run it together in some sort of watch mode along side bsb -make-world -w and next dev, to get all build errors immediately.
I am strangely able to upgrade without adding the patchResDeps hack, even though I encountered the error that you encountered in the past…
I see now that 7.1.0 removed the main requirement:
When trying to locate the packages you are trying to transpile, since v5, next-transpile-modules tries to resolve your module names you pass to it, which required a valid main or exports field. It will now tries to resolve directly to its package.json.
I was trying ntm v7.1 so I removed node_modules to attempt next.config.js without the patchResDeps but now I get this error
Could not resolve @reasonml-community/graphql-ppx/ppx in /Users/jorge/code/app
Fatal error: exception Failure("@reasonml-community/graphql-ppx/ppx not found when resolving ppx-flags")
The terminal process "/bin/zsh '-c', 'npm run build-brezza'" terminated with exit code: 2.
any clue what’s happening here? I tried to roll back and it still throws the error
Update
Seems that it was because I had graphql-ppx in my dependencies instead of my dev-dependencies in package.json. It’s working now
If we stored static data and markdown strings as constants in ReScript modules, and people figure out how to use esm modules with vite and ReScript, it feels like a static site generator will become irrelevant.