| title | Migration Guide (0.x → 1.0) |
|---|---|
| layout | default |
| nav_order | 9 |
This page covers the changes needed when upgrading from NextFs 0.x to 1.0.
The biggest change in 1.0 is the elimination of handwritten nextfs.entries.json.
You maintained nextfs.entries.json manually:
{
"entries": [
{
"fable": ".fable/App.Page/App.Page.js",
"output": "app/page.js",
"directive": "use client",
"default": "Page"
}
]
}Annotate each entry module directly in F#:
[<NextFs.NextFsEntry("app/page.js", Directive="use client", Default="Page")>]
module App.PageThen generate the manifest automatically:
node tools/nextfs-scan.mjs path/to/YourProject.fsprojThe scanner reads [<NextFsEntry>] attributes from your .fs files and writes nextfs.entries.json for you.
dotnet add package NextFs --version 1.0.0For each entry in your existing nextfs.entries.json, add a matching [<NextFs.NextFsEntry(...)>] attribute before the module declaration and before any open statements.
| JSON field | Attribute parameter |
|---|---|
"output" |
positional: "app/page.js" |
"directive" |
Directive="use client" or Directive="use server" |
"default" |
Default="Page" |
"named" |
Named="metadata viewport" (space-separated) |
"exportAll" |
ExportAll=true |
Example — a client page with metadata:
// Before: only module declaration
module App.Page
// After: add attribute before module
[<NextFs.NextFsEntry("app/page.js", Directive="use client", Default="Page", Named="metadata")>]
module App.PageFor static literal exports (e.g. proxy config), use [<NextFs.NextFsStaticExport>]:
[<NextFs.NextFsEntry("proxy.js", Named="proxy")>]
[<NextFs.NextFsStaticExport("config", """{"matcher":["/((?!_next).*)"]}""")>]
module Proxy{
"scripts": {
"scan": "node tools/nextfs-scan.mjs src/YourProject.fsproj"
}
}npm run scanThis overwrites nextfs.entries.json from your F# attributes. Verify the output matches your previous manual file.
node tools/nextfs-entry.mjs nextfs.entries.jsonThe generated wrapper files should be identical to what you had before.
dotnet fable src/YourProject.fsproj
npm run buildFrom this point, nextfs.entries.json is generated — never edit it by hand. Add the scan step to your dev workflow:
{
"scripts": {
"scan": "node tools/nextfs-scan.mjs src/YourProject.fsproj",
"sync:app": "npm run scan && node tools/nextfs-entry.mjs nextfs.entries.json"
}
}No module renames in 1.0. The client/server split introduced in 0.9 (NavigationClient, LinkClient, WebVitals for client hooks vs Navigation, Server for server helpers) remains unchanged.
[<NextFs.NextFsEntry>]attribute[<NextFs.NextFsStaticExport>]attributetools/nextfs-scan.mjsscanner
The following APIs are included in 1.0 but depend on Next.js experimental flags. They may change without a NextFs major bump if Next.js changes or removes them:
Navigation.forbidden()/Navigation.unauthorized()— requireexperimental.authInterrupts: trueDirective.useCachePrivate()/Directive.useCacheRemote()— requireexperimental.dynamicIONavigationClient.unstableIsUnrecognizedActionError— wraps an upstreamunstable_*functionProxyConfig— proxy support varies by Next.js version
See the FAQ or open a GitHub Discussion.