@breezehr/next-static-paths
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

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 "@breezehr/next-static-paths";
function MyComponent() {
  return (
    <TypedLink as="/some/[myArgument]" myArgument="hello world">
      Hello world
    </TypedLink>
  );
}

pathFor helper

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

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

Readme

Keywords

none

Package Sidebar

Install

npm i @breezehr/next-static-paths

Weekly Downloads

1

Version

0.4.2

License

MIT

Unpacked Size

229 kB

Total Files

18

Last publish

Collaborators

  • osdiab