Upgrading
Contents
Guillotine application
| Guillotine version 7 is required if you need to modify graphql schema in your application. |
Upgrading from v2.x
-
You need to use Next.js app router to be able to use v3.x. See upgrade instructions from pages router here.
-
_renderablepage is now an API route atsrc/api/renderable/route.ts. -
@enonic/nextjs-adaptermethods renamed:-
getLocaleProjectConfig() → getLocaleMapping()
-
getProjectLocaleConfigById → getLocaleMappingById()
-
-
@enonic/nextjs-adaptermethod signature changes:-
fetchFromApimethod changed to :fetchFromApi( apiUrl: string, projectConfig: ProjectLocaleConfig, options?: FetchOptions): Promise<GuillotineResponseJson>
-
fetchGuillotinemethod signature changes:fetchGuillotine( contentApiUrl: string, projectConfig: ProjectLocaleConfig, options?: FetchOptions): Promise<GuillotineResult>
-
-
@enonic/nextjs-adapterexports rearranged:Exports working both on the server and client sides are now available from
@enonic/nextjs-adapterpackage root. Client-only exports are available from@enonic/nextjs-adapter/clientpackage. Server-only exports are available from@enonic/nextjs-adapter/serverpackage. Views are available at@enonic/nextjs-adapter/views/<ViewName>. -
ENONIC_PROJECTSenvironmental variable change:ENONIC_PROJECTS -> ENONIC_MAPPINGS
Language is now required for every project config:ENONIC_MAPPINGS=<lang>:<repo-name>/site/path[,<lang>:<repo-name>/site/path,...]
First config in the list is used as default. -
next.config.jsconfig changes:Remove i18n block from next.js config:i18n: { locales: ['en', 'no'], defaultLocale: 'en', }Add phrases block to webpack config:config.resolve.alias = { ...config.resolve.alias, "@phrases": path.resolve(__dirname, "./src/phrases"), } -
Add
src/phrasesfolder to your project root. This folder should contain static translations for every language fromENONIC_MAPPINGSenv var in the following format:src/phrases/<lang>.jsonsrc/phrases/en.json src/phrases/no.json
-
Middleware file has been updated to support new i18n config. If you have custom middleware, you need to update it to support new i18n config.