Skip to content

"convex dev" CLI doesn't hot-reload when a dependent file is saved #73

Open
@mfucek

Description

@mfucek

Hello 👋

Context

I have configured my project to have the convex directory under the src/deps folder.

{
	"$schema": "https://raw.githubusercontent.com/get-convex/convex-backend/refs/heads/main/npm-packages/convex/schemas/convex.schema.json",
	"functions": ["src/deps/convex", "src/modules/**/convex"]
}

Under src/deps/convex/schema.ts I have a task table which is imported from elsewhere.

import { taskTable } from '@/modules/task/convex/schema';
import { defineSchema } from 'convex/server';

export default defineSchema({
	task: taskTable
});

Problem

The problem is: the convex backend only refreshes if files under src/deps/convex change, but not when the imported dependent files change also - This results in having to redundantly save any file in the convex directory to see the changes reflected on the backend.

Any ideas how to overcome this issue? I am considering using Convex for a larger project with a large number of "modules" each having it's own table and functions. Having a neat folder structure is a must for such a use case.

Proposed solutions

1) Allow for specifying which folders the CLI should watch through a flag

  • A potential solution could look like this: bunx convex dev --watch src/modules/**/convex

2) Extending the schema so that dependent folders can be specified

{
	"$schema": "https://raw.githubusercontent.com/get-convex/convex-backend/refs/heads/main/npm-packages/convex/schemas/convex.schema.json",
	"root": "src/deps/convex"
	"dependencies": [
		"src/modules/post/convex",
		"src/modules/profile/convex",
		"src/modules/settings/convex"
	]
}

3) Allow for multiple functions directories to be specified

{
	"$schema": "https://raw.githubusercontent.com/get-convex/convex-backend/refs/heads/main/npm-packages/convex/schemas/convex.schema.json",
	"functions": ["src/deps/convex", "src/modules/**/convex"]
}
  • issue being where would the _generated folder be 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions