You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The build doesn't fail, even with a low inotify watch limit.
This worked fine, up until remix 2.14.0. After digging a little deeper, it looks like this happens because the vite plugin now creates a dev server, even when doing a production build, and that server appears to watch basically everything in the project directory.
Going even deeper, it seems like the actual culprit is this:
The { server: { watch: null } } value never actually makes it to the vite.createServer call.
This means that there is currently no way to merge nullorundefined values into the vite config using vite.mergeConfig, which is unfortunate, because both have pretty distinctive meanings inside server.watch.
> npm run build ✔ 4s
> build
> remix vite:build
node:internal/fs/watchers:247
const error = new UVException({
^
Error: ENOSPC: System limit for number of file watchers reached, watch '«project-directory»'
at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
at Object.watch (node:fs:2468:36)
at createFsWatchInstance (file://«project-directory»/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:42779:17)
at setFsWatchListener (file://«project-directory»/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:42826:15)
at NodeFsHandler._watchWithNodeFs (file://«project-directory»/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:42981:14)
at NodeFsHandler._handleDir (file://«project-directory»/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:43217:19)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at NodeFsHandler._addToNodeFs (file://«project-directory»/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:43267:16)
at file://«project-directory»/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:44284:21
at async Promise.all (index 0)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (file://«project-directory»/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:44480:10)
at NodeFsHandler._addToNodeFs (file://«project-directory»/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:43295:18)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at file://«project-directory»/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:44284:21
at async Promise.all (index 0) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '«project-directory»',
filename: '«project-directory»'
}
Node.js v22.11.0
The text was updated successfully, but these errors were encountered:
Reproduction
npx create-remix
)sudo sysctl fs.inotify.max_user_watches=10000
)sudo sysctl --system
)npm run build
System Info
Used Package Manager
npm
Expected Behavior
The build doesn't fail, even with a low inotify watch limit.
This worked fine, up until remix 2.14.0. After digging a little deeper, it looks like this happens because the vite plugin now creates a dev server, even when doing a production build, and that server appears to watch basically everything in the project directory.
Going even deeper, it seems like the actual culprit is this:
ViteNode.createContext
is called withserver: { watch: null }
ViteNode.createContext
callsvite.mergeConfig
with its own server config and theviteConfig
argumentvite.mergeConfig
explicitly doesn't mergenull
andundefined
values into the base config (becausenull == undefined
){ server: { watch: null } }
value never actually makes it to thevite.createServer
call.This means that there is currently no way to merge
null
orundefined
values into the vite config usingvite.mergeConfig
, which is unfortunate, because both have pretty distinctive meanings insideserver.watch
.I've opened an issue for this
mergeConfig
quirk over at the vite repository as well.If they decide that this isn't a bug, but a feature, the watch config would have to manually be merged by remix.
Possibly related to #10250.
Actual Behavior
The build fails with the following output:
Error
The text was updated successfully, but these errors were encountered: