Lock files (like
package-lock.json if you're using npm) should be committed to ensure reproducible builds whenever anybody clones your repo.
Now we're ready, let's start a new project using Fable!
Use the official templates
Use a Fable template
ATTENTION: Templates may not be yet updated to Fable 3
The easiest way to get started with Fable is to use one of the Fable official templates. First list them, then pick a template with a name that starts with "fable" to create a new project.
dotnet new -i 'Fable.Template::*'
mkdir MyFirstFableProject ; cd MyFirstFableProject
dotnet new fable
or, for example,
dotnet new fable-react-elmish
JS dependencies are listed in the
package.jsonfile. You can run
npm install, which will download the needed packages to the
node_modulesfolder and create a lock file.
.NET dependencies are listed in the
src/App.fsprojfile. You can install them by running
dotnet restore, but this is already automatically done by Fable.
Build & run the app
Here we go.
Your web server app is now running in foreground until you kill it.
While the server is running
- You can access your project at http://localhost:8080/ with your favorite browser.
- The server is in “watch” mode, so you will see server console output in the terminal window.
- You can edit the
App.fsfile located in the
srcfolder. Each time you save the file, Fable rebuilds the project automatically. If the build succeeds, you will see your changes in the browser without refreshing the page; if not, nothing changes in the browser, and you can see the build errors in the server’s console output.