@dataweavers/spark-nextjs
v1.0.18
Published
NextJS module to accept on-demand regeneration requests, containing a payload specifying which sites and url paths need to have their statically generated pages invalidated and/or regenerated.
Downloads
460
Readme
Dataweavers Spark
This package is to be used in conjunction with the Dataweavers Spark product.
For more information on Spark please visit https://www.dataweavers.com/products/spark
Module Setup
Install the module
In a PowerShell terminal, navigate to the root of your next.js application.
Run
npm install @dataweavers/spark-nextjsSet the Spark API Key
Set the environment variable for the Next.js application to the Edge API Key provided by your Spark Subscription Environment (https://app.spark.dataweavers.io/)
- Variable name:
SPARK_REGENERATION_SECRET - Variable value:
[provided in the Spark Application]
- Variable name:
(optional) Set the log level for Spark
Set the environment variable for the Next.js application for the Spark log level.
Spark provides logging in order to understand the process it goes through in the headless environment.
- Variable name:
SPARK_LOG_LEVEL - Variable value:
DEBUG|INFO|WARN|ERROR|SILENT
Default value is: INFO
- Variable name:
Extract the locales to a separate js file for sharing with the module
- Open the next.config.js from your project and copy the array value from the i18n.locales property, e.g. [ "en" ]
- Paste the array value into a new file, i18nLocales.json in the same directory
- Update the next.config.js to reference the file:
- Add const localesFile = require('./i18nLocales.json'); to the top of the config
- Update the locales value: locales: localesFile,
