hypernova-plugin-server-stacktrace is a small plugin for Hypernova especially in production. The plugin enables you to log a stack trace when the server fails to render components.
For npm:
npm install hypernova-plugin-server-stacktrace --saveAdd the plugin object to plugins array of the server configuration:
const hypernova = require('hypernova/server'); const ServerStacktracePlugin = require('hypernova-plugin-server-stacktrace'); hypernova({ plugins: [new ServerStacktracePlugin()] });This will output errors to STDOUT as follows:
2019-01-01T08:43:00.647Z - error: TypeError: foo.bar is not a function at Top (/pass/to/build/pages/webpack:/src/pages/index.tsx:16:1) at processChild (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:2458:14) at resolve (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:2384:5) at ReactDOMServerRenderer.render (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:2706:22) at ReactDOMServerRenderer.read (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:2680:23) at Object.renderToStaticMarkup (/pass/to/node_modules/react-dom/cjs/react-dom-server.node.development.js:3082:25) at /pass/to/build/pages/webpack:/src/lib/hypernova-react.ts:48:1 at /pass/to/node_modules/hypernova/lib/utils/BatchManager.js:190:18 at tryCatcher (/pass/to/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/pass/to/node_modules/bluebird/js/release/promise.js:512:31) Note that you're able to customize the log format and destination by logger or loggerInstance. For further information, please see the section on server configuration options.
You should follow the steps below.
- Fork the repository
- Create a feature branch:
git checkout -b add-new-feature - Commit your changes:
git commit -am 'Add new feature' - Push the branch:
git push origin add-new-feature - Send us a pull request
The library is available as open source under the terms of the MIT License.