Skip to main content

Plugin

The NextGlobeGen Plugin needs to be enabled in Next.js configuration file. It sets up the required import aliases for the package to work correctly. It also regenerates the localized routes, messages and the types for the package when changes are made in the source code.

createNextGlobeGenPluginโ€‹

This function creates the wrapper function for your Next.js config object.

import type { NextConfig } from "next";
import createNextGlobeGenPlugin from "next-globe-gen/plugin";

const withNextGlobeGen = createNextGlobeGenPlugin();

const nextConfig: NextConfig = {
/* Next.js config options here */
};

export default withNextGlobeGen(nextConfig);

Parametersโ€‹

createNextGlobeGenPlugin(configPath?: string);
ParamTypeRequiredDescriptionDefault
configPathstring-Path to a NextGlobeGen config file./i18n.config.ts

Returnsโ€‹

createNextGlobeGenPlugin returns a function, which should be called with your Next.js config object. It returns the given config object with few added import aliases.