0.4.x to 0.5.x
Upgrade
soya-nextto0.5.xand next to5.x.xyarn add soya-next next@5Add
soya-next-serverto start server in production environmentyarn add soya-next-serverMove
soya-next-scriptstodevDependenciesand upgrade it to0.5.xyarn remove soya-next-scripts yarn add --dev soya-next-scriptsRemove
styled-modulesdependency frompackage.jsonand.babelrcyarn remove styled-modules{ ... "plugins": [ ... - "styled-modules/babel" ... ] }Update
scriptsinpackage.json:{ ... "scripts": { - "analyze": "ANALYZE=1 soya-next-scripts build", + "analyze": "BUNDLE_ANALYZE=both soya-next-scripts build", + "analyze:browser": "BUNDLE_ANALYZE=browser soya-next-scripts build", + "analyze:server": "BUNDLE_ANALYZE=server soya-next-scripts build", - "start": "soya-next-scripts start", + "dev": "soya-next-scripts dev", + "start": "soya-next-server", } ... }If you have custom document (
pages/_document.js), include/_next/static/style.cssinto<head>:import Document, { Head, Main, NextScript } from "next/document"; import config from "config"; import htmlescape from "htmlescape"; const __NEXT_CONFIG__ = { ...config }; // exclude legacy and server config delete __NEXT_CONFIG__.legacy; delete __NEXT_CONFIG__.server; export default class extends Document { render() { const { __NEXT_DATA__ } = this.props; return ( <html> <Head> <link rel="stylesheet" href={`${__NEXT_DATA__.assetPrefix}/_next/static/style.css`} /> </Head> <body> <Main /> <script // eslint-disable-next-line react/no-danger dangerouslySetInnerHTML={{ __html: `__NEXT_CONFIG__ = ${htmlescape(__NEXT_CONFIG__)}` }} /> <NextScript /> </body> </html> ); } }
Last updated