Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@nirtamir2/next-static-paths

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nirtamir2/next-static-paths

Static types for routing in Next.js apps

latest
Source
npmnpm
Version
0.6.0
Version published
Weekly downloads
27
22.73%
Maintainers
1
Weekly downloads
 
Created
Source

next-static-paths

Statically prevent HTTP 404 Not Found in your Next.js applications using TypeScript and code generation.

Usage

$ pnpm add next-static-paths
# or
$ yarn add next-static-paths
# or
$ npm install next-static-paths

Then, from within your Next.js application root, run the following command:

# For pnpm users
$ pnpx next-static-paths

# For yarn users
$ yarn next-static-paths

# For npm users
$ npx next-static-paths

It's recommended to configure scripts in your package.json too

{
  "dev": "next-static-paths --pages-dir ./src --output . && next dev",
  "generate-routes": "next-static-paths --pages-dir ./src --output . && :"
}
import { TypedLink } from "@nirtamir2/next-static-paths";
function MyComponent() {
  return (
    <TypedLink as="/some/[myArgument]" myArgument="hello world">
      Hello world
    </TypedLink>
  );
}

pathFor helper

import { pathFor } from "@nirtamir2/next-static-paths";

function getPath() {
  return pathFor("/some/[myArgument]", { myArgument: "hello world" });
}

FAQs

Package last updated on 17 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts