Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

# 11.0.0-rc.4 (Unreleased)

#### :boom: Breaking Change

- Updated watcher rules to recompile only on config and `*.res`/`*.resi`/`*.ml`/`.mli` file changes. Solves the issue of unnecessary recompiles on `.css`, `.ts`, and other unrelated file changes. https://github.com/rescript-lang/rescript-compiler/pull/6420

#### :bug: Bug Fix

- Fix issue with GenType and labelled arguments. https://github.com/rescript-lang/rescript-compiler/pull/6406
Expand Down
38 changes: 12 additions & 26 deletions rescript
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@ process.env.BSB_PROJECT_ROOT = cwd;
const isTtyError = process.stderr.isTTY;
const isTtyStd = process.stdout.isTTY;

var bsConfig = "bsconfig.json"
var resConfig = "rescript.json";
var resConfigFile = path.join(cwd, resConfig);
if (!fs.existsSync(resConfigFile)) {
resConfig = bsConfig;
resConfigFile = path.join(cwd, bsConfig);
}

// If the project uses gentype and uses custom file extension
// via generatedFileExtension, ignore them in watch mode
var genTypeFileExtension = ".gen.tsx";
if (fs.existsSync(resConfigFile)) {
var genTypeConfig = require(resConfigFile).gentypeconfig
if (genTypeConfig) {
genTypeFileExtension = genTypeConfig.generatedFileExtension;
}
}

let verbose = false;

/**
Expand Down Expand Up @@ -239,6 +221,11 @@ if (maybeSubcommand === "build" && process_argv.includes("-w")) {
let webSocketHost = "localhost";
let webSocketPort = 9999;

let resConfig = "rescript.json";
if (!fs.existsSync(resConfig)) {
resConfig = "bsconfig.json";
}

const sourcedirs = path.join("lib", "bs", ".sourcedirs.json");

let LAST_BUILD_START = 0;
Expand Down Expand Up @@ -364,14 +351,13 @@ Please pick a different one using the \`-ws [host:]port\` flag from bsb.`);
// This could cause problems if source builds (generating js files in the same directory) are supported.
if (!fileName) return true;

return !(
fileName === ".merlin" ||
fileName.endsWith(".js") ||
fileName.endsWith(".mjs") ||
fileName.endsWith(".cjs") ||
fileName.endsWith(genTypeFileExtension) ||
watchGenerated.indexOf(fileName) >= 0 ||
fileName.endsWith(".swp")
return (
((fileName.endsWith(".res") ||
fileName.endsWith(".resi") ||
fileName.endsWith(".ml") ||
fileName.endsWith(".mli")) &&
!watchGenerated.includes(fileName)) ||
fileName === resConfig
);
}

Expand Down