Skip to content

Conversation

@illusionalsagacity
Copy link
Contributor

Ignoring these directories prevents HMR reloads when the rescript compiler runs, ensuring HMR is only triggered when the output files are actually changed by the compiler.

https://forum.rescript-lang.org/t/compiler-warnings-can-cause-hmr-de-optimizations/7020?u=illusionalsagacity

Copy link
Member

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good.
@cknitt or @fhammerschmidt could you give your blessings on the Next changes. I don't know how that works.

@fhammerschmidt
Copy link
Member

fhammerschmidt commented Nov 17, 2025

yeah it looks weird to me at least, why isn't it just like in vite?

e.g.:

config.watchOptions = {
  ...config.watchOptions,
  ignored = [
    "**/lib/bs/**",
    "**/lib/ocaml/**",
    "**/lib/rescript.lock"
  ]
}

And I think you should never use path.join where glob patterns are expected, cause they normalize to \-paths on Windows, which is too early and then it's not interpreted as a path separator anymore. Webpack handles path normalization itself.

@illusionalsagacity illusionalsagacity force-pushed the ignore-rescript-build-artifacts branch from 7048f84 to 050282b Compare November 17, 2025 14:10
Copy link
Contributor Author

@illusionalsagacity illusionalsagacity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the next.js webpack watch options to use the globs like vite

then it's not interpreted as a path separator anymore. Webpack handles path normalization itself.

Ah, I'd always used path.join in my webpack configs before, I hadn't run into this before.

@illusionalsagacity illusionalsagacity force-pushed the ignore-rescript-build-artifacts branch from 050282b to 5e2aac1 Compare November 17, 2025 14:19
Copy link
Member

@fhammerschmidt fhammerschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@fhammerschmidt fhammerschmidt merged commit e9995b5 into rescript-lang:master Nov 17, 2025
7 checks passed
@illusionalsagacity illusionalsagacity deleted the ignore-rescript-build-artifacts branch November 17, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants