0.6.0 • Published 2 years ago

@nirtamir2/next-static-paths v0.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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 . && :"
}

TypedLink component

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" });
}
0.3.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.6.0

2 years ago

0.1.0

2 years ago

0.2.0

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.10-canary.1

2 years ago