This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

next-firebase-hosting-rewrites
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Next.JS Firebase Hosting Rewrite Rules Module

Ensure that firebase.json contains the appropriate hosting rewrites for NextJS dynamic routes.

WARNINGS!

This module has been tested only in the described scenario using NextJS 13.5, Yarn 4 (with PnP), Node 20.

Missing rewrite rules will fail your build and print out instructions on how to fix it.

Use this if

  1. You use next export to export your app to static HTML
  2. You deploy the static site to Firebase Hosting
  3. You deploy the site to one or more hosting sites

Usage

yarn add next-firebase-hosting-rewrites

On your next.config.js

// next.config.js
const { withFHR } = require('next-firebase-hosting-rewrites')([
  'site-name-1',
  'site-name-2',
])

module.exports = withFHR()

Sample

If you have any of the following files in your NextJS project, it will result in the output below.

  • pages/auth/action/reset-password/[oobCode].tsx
  • pages/auth/action/reset-password/[oobCode]/index.tsx
[...]
info  - using build directory: /Users/user/repo/hosting/.next
info  - Copying "static build" directory
info  - Launching 7 workers
> [FHR] Validating Firebase Hosting Rules (FHR)...
> [FHR] Found Firebase config at /Users/user/repo/firebase.json.
> [FHR] REWRITE RULE ERROR @ firebase.json/hosting/[site="site-name-1"]
> [FHR] Missing rewrite rule for site path '/auth/action/reset-password/[oobCode]'.
> [FHR] Include the following rewrite rule in firebase.json:
> [FHR]
> [FHR] {"source":"/auth/action/reset-password/*","destination":"/auth/action/reset-password/[oobCode].html"}
> [FHR]
Error: One or more rewrites rules missing or erroneous in '/Users/user/repo/firebase.json'.

[...stack trace here]

user@Machine-Name hosting %

Package Sidebar

Install

npm i next-firebase-hosting-rewrites

Weekly Downloads

94

Version

1.0.9

License

MIT

Unpacked Size

29.3 MB

Total Files

96

Last publish

Collaborators

  • ericvera