0.4.0 • Published 1 year ago

next-rsc-error-handler v0.4.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

next-rsc-error-handler

Webpack plugin that allow to handle RSC errors on the server side.

This plugin does not allow to use dual client and server components

Get started

  • Install the dependency npm i next-rsc-error-handler
  • In your next config add the plugin:
import { rscErrorHandler } from "next-rsc-error-handler";

const withRscErrorHandler = rscErrorHandler({
  componentName: /^_?[A-Z]/, // optional, defaults to /^[A-Z]/
});

export default withRscErrorHandler({
  // next config here
});
  • Add global-server-error.js in your root folder with following content:
/** @type {import('next-rsc-error-handler').GlobalServerError} */
export default function onGlobalServerError(err, ctx) {
  // handling here
}

Alternatively, you can use global-server-error.ts with:

import { type GlobalServerErrorContext } from 'next-rsc-error-handler';

export default function onGlobalServerError(err: unknown, ctx: GlobalServerErrorContext) {
  // handling here
}

License

Apache-2.0

0.3.0

1 year ago

0.3.2

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago