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.
-
_renderable
page is now an API route atsrc/api/renderable/route.ts
. -
@enonic/nextjs-adapter
methods renamed:-
getLocaleProjectConfig() → getLocaleMapping()
-
getProjectLocaleConfigById → getLocaleMappingById()
-
-
@enonic/nextjs-adapter
method signature changes:-
fetchFromApi
method changed to :fetchFromApi( apiUrl: string, projectConfig: ProjectLocaleConfig, options?: FetchOptions): Promise<GuillotineResponseJson>
-
fetchGuillotine
method signature changes:fetchGuillotine( contentApiUrl: string, projectConfig: ProjectLocaleConfig, options?: FetchOptions): Promise<GuillotineResult>
-
-
@enonic/nextjs-adapter
exports rearranged:Exports working both on the server and client sides are now available from
@enonic/nextjs-adapter
package root. Client-only exports are available from@enonic/nextjs-adapter/client
package. Server-only exports are available from@enonic/nextjs-adapter/server
package. Views are available at@enonic/nextjs-adapter/views/<ViewName>
. -
ENONIC_PROJECTS
environmental 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.js
config 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/phrases
folder to your project root. This folder should contain static translations for every language fromENONIC_MAPPINGS
env var in the following format:src/phrases/<lang>.json
src/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.