Skip to content

fix: update vite + nextjs config to ignore rescript build artifacts#102

Merged
fhammerschmidt merged 1 commit into
rescript-lang:masterfrom
illusionalsagacity:ignore-rescript-build-artifacts
Nov 17, 2025
Merged

fix: update vite + nextjs config to ignore rescript build artifacts#102
fhammerschmidt merged 1 commit into
rescript-lang:masterfrom
illusionalsagacity:ignore-rescript-build-artifacts

Conversation

@illusionalsagacity

Copy link
Copy Markdown
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

@nojaf nojaf left a comment

Copy link
Copy Markdown
Member

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

fhammerschmidt commented Nov 17, 2025

Copy link
Copy Markdown
Member

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

@illusionalsagacity illusionalsagacity left a comment

Copy link
Copy Markdown
Contributor Author

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

@fhammerschmidt fhammerschmidt left a comment

Copy link
Copy Markdown
Member

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