Configuring a Repl
Last updated
Was this helpful?
Last updated
Was this helpful?
A file named .replit
can be added to any repl in order to customize the behavior of the repl. Used in combination with for installed linux packages, the sky is the limit! Written in , a .replit
file looks something like:
Here's a short video on how to use the .replit
file or read the text explanation below.
Here is an example of a repl using .replit
to print "hello world" instead of running the code:
When you clone a repository without a .replit
file, we automatically show the visual .replit
editor:
This will automatically create the .replit
file and make it possible to customize how the repl will run. You can use the shell to run any command and then set the "Run" button once you've decided what it should do. Clicking "done" will finalize the repl's configuration and close the visual editor. It's always possible to make changes later by visiting the .replit
file from the filetree. Adding .replit
to a repository makes cloning fast with no configuration necessary.
The .replit
file can also provide other configuration hints. The full specification is provided below:
run
: Command - Command that is executed when the run button is clicked
language
: Reserved
onBoot
: Command - Command that is executed once when the repl first starts up
packager
: Package management configuration.
afterInstall
: Command - Command that is executed after a new package is installed
features
: UPM features that are supported by the specified languages.
packageSearch
: Boolean - If enabled, a package search panel will be available in the sidebar.
guessImports
: Boolean - If enabled, UPM will attempt to guess which packages need to be installed prior to running the repl.
languages.<language name>
: Per-language configuration. The language name has no special meaning other than to allow multiple languages to be configured at once.
start
: Command - The command used to start the LSP server
A command can either be a string or a list of strings. If the command is a string ("node index.js"
), it will be executed via sh -c "<command>"
. If the command is a list of strings (["node", "index.js"]
), it will be directly executed with the list of strings passed as arguments. When possible, it is preferred to pass a list of strings.
For HTML projects, you can keep the run command empty and we will serve the project for you automatically. As per web standards, the entrypoint file is index.html
. If you want to serve a different file, you can roll your own webserver in one of the languages that we support.
.replit
In the snippet above, run
is a string which will be executed in the shell whenever you hit the "Run" button. The language
helps the IDE understand how to provide features like and . This is normally configured for you when you clone from a Git repository.
audio
: Boolean - Whether is enabled for this repl.
ignoredPaths
: List of Strings - List of paths to ignore while attempting to guess packages ()
ignoredPackages
: List of strings - List of modules to never attempt to guess a package for, when installing packages ()
language
: String - Specified the language to use for package operations. See available languages in the repository.
pattern
: String - A used to identify which files belong to this language configuration. (Example: **/*.js
)
languageServer
: Configuration for setting up for this language. This allows for code intelligence (autocomplete, underlined errors, etc...)
We created an for you in NodeJS that serves foo.html
instead of index.html
. Otherwise it works like any other HTML project.