-
-
Notifications
You must be signed in to change notification settings - Fork 932
Closed
Labels
discussionThe approach has not yet been decidedThe approach has not yet been decided
Description
Based on a conversation in Discord
./src/ is a great default, but occasionally you run into constraints that require something a bit more customizable.
In gleam.toml, we could potentially let you specify something like...
source = "./api/"We might even want to let you specify multiple source directories...
source = ["./api/", "./lib/"]...which would unfortunately be a bit ambiguous. Should import a/b resolve to ./api/a/b.gleam or ./lib/a/b.gleam if there's a conflict? Maybe we just throw an error if it could be resolved more than one way?
Another solution could be a "shared root" similar to what TypeScript does
# Must be a parent of all modules
sourceRoot = "./"
# These would probably be "Gleam paths" and not fs paths.
# They would be resolved relative to `sourceRoot`
modules = ["api", "lib"] ...which in Gleam could then allow you to...
import lib/some/shared/logic.{Whatever}
// ......where the prefix makes imports unambiguous.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
discussionThe approach has not yet been decidedThe approach has not yet been decided