Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Next.js v10.2 #313

Merged
merged 7 commits into from
May 8, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,20 @@ module.exports = withBundleAnalyzer(withSourceMaps({
return redirects;
},

future: {
// See https://nextjs.org/docs/messages/webpack5
// Necessary to manually specify to use webpack 5, because we use a custom "webpack" config (see below)
webpack5: true,
},

resolve: {
fallback: {
// Fixes npm packages that depend on `fs` module
fs: false,
},
},

/**
*
* The webpack function is executed twice, once for the server and once for the client.
* This allows you to distinguish between client and server configuration using the isServer property.
*
Expand All @@ -201,7 +213,8 @@ module.exports = withBundleAnalyzer(withSourceMaps({

const APP_VERSION_RELEASE = APP_RELEASE_TAG || buildId;
config.plugins.map((plugin, i) => {
if (plugin.definitions) { // If it has a "definitions" key, then we consider it's the DefinePlugin where ENV vars are stored
// Inject custom environment variables in "DefinePlugin" - See https://webpack.js.org/plugins/define-plugin/
if (plugin.__proto__.constructor.name === 'DefinePlugin') {
// Dynamically add some "public env" variables that will be replaced during the build through "DefinePlugin"
// Those variables are considered public because they are available at build time and at run time (they'll be replaced during initial build, by their value)
plugin.definitions['process.env.NEXT_PUBLIC_APP_BUILD_ID'] = JSON.stringify(buildId);
Expand All @@ -213,11 +226,6 @@ module.exports = withBundleAnalyzer(withSourceMaps({
console.debug(`[webpack] Building release "${APP_VERSION_RELEASE}" using NODE_ENV="${process.env.NODE_ENV}" ${process.env.IS_SERVER_INITIAL_BUILD ? 'with IS_SERVER_INITIAL_BUILD="1"' : ''}`);
}

// Fixes npm packages that depend on `fs` module
config.node = {
fs: 'empty',
};

// XXX See https://github.com/vercel/next.js/blob/canary/examples/with-sentry-simple/next.config.js
// In `pages/_app.js`, Sentry is imported from @sentry/node. While
// @sentry/browser will run in a Node.js environment, @sentry/node will use
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"lodash.startswith": "4.2.1",
"lodash.xorby": "4.7.0",
"markdown-to-jsx": "7.1.2",
"next": "10.1.2",
"next": "10.2.0",
"next-cookies": "2.0.3",
"prop-types": "15.7.2",
"rc-tooltip": "5.1.0",
Expand Down
105 changes: 47 additions & 58 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2317,20 +2317,20 @@
dependencies:
webpack-bundle-analyzer "4.3.0"

"@next/env@10.1.2":
version "10.1.2"
resolved "https://registry.yarnpkg.com/@next/env/-/env-10.1.2.tgz#04888eb7115a5b0633dc59e321e5c952917a39d5"
integrity sha512-G6kEq7dr7f+unVTUL74lIaB6njB73vEMVi7AhujaNnNZr6z8jQ43jCjNyawQsNyoNWsRo/9x6x9W72PbrGmy/w==
"@next/env@10.2.0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@next/env/-/env-10.2.0.tgz#154dbce2efa3ad067ebd20b7d0aa9aed775e7c97"
integrity sha512-tsWBsn1Rb6hXRaHc/pWMCpZ4Ipkf3OCbZ54ef5ukgIyEvzzGdGFXQshPP2AF7yb+8yMpunWs7vOMZW3e8oPF6A==

"@next/polyfill-module@10.1.2":
version "10.1.2"
resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-10.1.2.tgz#0cad99af18da0f90a63a25b60602ab46650017e6"
integrity sha512-9+xXb33HIPCrV0yM79blqwgLa+fkvm0gYs/wUDI0pPBCHkMpCZA/SWUeF/yKDY6qWO79H3B5pWTziLmzycQPWA==
"@next/polyfill-module@10.2.0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-10.2.0.tgz#61f41110c4b465cc26d113e2054e205df61c3594"
integrity sha512-Nl3GexIUXsmuggkUqrRFyE/2k7UI44JaVzSywtXEyHzxpZm2a5bdMaWuC89pgLiFDDOqmbqyLAbtwm5lNxa7Eg==

"@next/react-dev-overlay@10.1.2":
version "10.1.2"
resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-10.1.2.tgz#e98edfdc7fbed4d0cb333594469c7fa62f96e6df"
integrity sha512-B81nhgkWr+MbDAXN9I38WIdhAKayfIzrnOXXF2MS4VgxyHBvYQQfmobNNE0XBByyDn0+Ww5s9xg3L6Shh9kWKA==
"@next/react-dev-overlay@10.2.0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-10.2.0.tgz#4220121abac7e3404cbaf467784aeecca8be46cf"
integrity sha512-PRIAoWog41hLN4iJ8dChKp4ysOX0Q8yiNQ/cwzyqEd3EjugkDV5OiKl3mumGKaApJaIra1MX6j1wgQRuLhuWMA==
dependencies:
"@babel/code-frame" "7.12.11"
anser "1.4.9"
Expand All @@ -2344,10 +2344,10 @@
stacktrace-parser "0.1.10"
strip-ansi "6.0.0"

"@next/react-refresh-utils@10.1.2":
version "10.1.2"
resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-10.1.2.tgz#1c60150bb3f004fb9dd02db387a952483e6e2e4c"
integrity sha512-SQvtCt6nNOkGKddidQehxtJKMkoapg/kbLy/HwrqU8WdVrVVAk8JQw/QjDHVEsdezRxspeNKbho4L+3jl4c9rw==
"@next/react-refresh-utils@10.2.0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-10.2.0.tgz#55953b697769c6647f371bc6bcd865a24e1a22e9"
integrity sha512-3I31K9B4hEQRl7yQ44Umyz+szHtuMJrNdwsgJGhoEnUCXSBRHp5wv5Zv8eDa2NewSbe53b2C0oOpivrzmdBakw==

"@nodelib/fs.scandir@2.1.4":
version "2.1.4"
Expand Down Expand Up @@ -6253,6 +6253,11 @@ caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.300011
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001205.tgz#d79bf6a6fb13196b4bb46e5143a22ca0242e0ef8"
integrity sha512-TL1GrS5V6LElbitPazidkBMD9sa448bQDDLrumDqaggmKFcuU2JW1wTOHJPukAcOMtEmLcmDJEzfRrf+GjM0Og==

caniuse-lite@^1.0.30001202:
version "1.0.30001223"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001223.tgz#39b49ff0bfb3ee3587000d2f66c47addc6e14443"
integrity sha512-k/RYs6zc/fjbxTjaWZemeSmOjO0JJV+KguOBA3NwPup8uzxM1cMhR2BD9XmO86GuqaqTCO8CgkgH9Rz//vdDiA==

capture-exit@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4"
Expand Down Expand Up @@ -7140,21 +7145,19 @@ cssesc@^3.0.0:
resolved "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==

cssnano-preset-simple@1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/cssnano-preset-simple/-/cssnano-preset-simple-1.2.2.tgz#c631bf79ffec7fdfc4069e2f2da3ca67d99d8413"
integrity sha512-gtvrcRSGtP3hA/wS8mFVinFnQdEsEpm3v4I/s/KmNjpdWaThV/4E5EojAzFXxyT5OCSRPLlHR9iQexAqKHlhGQ==
cssnano-preset-simple@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/cssnano-preset-simple/-/cssnano-preset-simple-2.0.0.tgz#b55e72cb970713f425560a0e141b0335249e2f96"
integrity sha512-HkufSLkaBJbKBFx/7aj5HmCK9Ni/JedRQm0mT2qBzMG/dEuJOLnMt2lK6K1rwOOyV4j9aSY+knbW9WoS7BYpzg==
dependencies:
caniuse-lite "^1.0.30001179"
postcss "^7.0.32"
caniuse-lite "^1.0.30001202"

cssnano-simple@1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/cssnano-simple/-/cssnano-simple-1.2.2.tgz#72c2c3970e67123c3b4130894a30dc1050267007"
integrity sha512-4slyYc1w4JhSbhVX5xi9G0aQ42JnRyPg+7l7cqoNyoIDzfWx40Rq3JQZnoAWDu60A4AvKVp9ln/YSUOdhDX68g==
cssnano-simple@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/cssnano-simple/-/cssnano-simple-2.0.0.tgz#930d9dcd8ba105c5a62ce719cb00854da58b5c05"
integrity sha512-0G3TXaFxlh/szPEG/o3VcmCwl0N3E60XNb9YZZijew5eIs6fLjJuOPxQd9yEBaX2p/YfJtt49i4vYi38iH6/6w==
dependencies:
cssnano-preset-simple "1.2.2"
postcss "^7.0.32"
cssnano-preset-simple "^2.0.0"

csso@^4.0.2:
version "4.2.0"
Expand Down Expand Up @@ -11596,14 +11599,6 @@ levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"

line-column@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/line-column/-/line-column-1.0.2.tgz#d25af2936b6f4849172b312e4792d1d987bc34a2"
integrity sha1-0lryk2tvSEkXKzEuR5LR2Ye8NKI=
dependencies:
isarray "^1.0.0"
isobject "^2.0.0"

lines-and-columns@^1.1.6:
version "1.1.6"
resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
Expand Down Expand Up @@ -12555,11 +12550,6 @@ nan@^2.12.1:
resolved "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19"
integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==

nanoid@^3.1.16:
version "3.1.20"
resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788"
integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==

nanoid@^3.1.22:
version "3.1.22"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.22.tgz#b35f8fb7d151990a8aebd5aa5015c03cf726f844"
Expand Down Expand Up @@ -12632,17 +12622,17 @@ next-unused@0.0.6:
ts-loader "^7.0.0"
typescript "^4.2.3"

next@10.1.2:
version "10.1.2"
resolved "https://registry.yarnpkg.com/next/-/next-10.1.2.tgz#2c508cc2982077f0bad6863be020c10c1d059970"
integrity sha512-S2KYS8NXeFmaJd8EyoC/kWi3uIlNz3PghnpDWYwy5dxhbtyaozK7fVpXmDcOTQEyYq3BZG5ph0B+hOsAwMdYfQ==
next@10.2.0:
version "10.2.0"
resolved "https://registry.yarnpkg.com/next/-/next-10.2.0.tgz#6654cc925d8abcb15474fa062fc6b3ee527dd6dc"
integrity sha512-PKDKCSF7s82xudu3kQhOEaokxggpbLEWouEUtzP6OqV0YqKYHF+Ff+BFLycEem8ixtTM2M6ElN0VRJcskJfxPQ==
dependencies:
"@babel/runtime" "7.12.5"
"@hapi/accept" "5.0.1"
"@next/env" "10.1.2"
"@next/polyfill-module" "10.1.2"
"@next/react-dev-overlay" "10.1.2"
"@next/react-refresh-utils" "10.1.2"
"@next/env" "10.2.0"
"@next/polyfill-module" "10.2.0"
"@next/react-dev-overlay" "10.2.0"
"@next/react-refresh-utils" "10.2.0"
"@opentelemetry/api" "0.14.0"
assert "2.0.0"
ast-types "0.13.2"
Expand All @@ -12654,7 +12644,7 @@ next@10.1.2:
chokidar "3.5.1"
constants-browserify "1.0.0"
crypto-browserify "3.12.0"
cssnano-simple "1.2.2"
cssnano-simple "2.0.0"
domain-browser "4.19.0"
encoding "0.1.13"
etag "1.8.1"
Expand All @@ -12670,7 +12660,7 @@ next@10.1.2:
p-limit "3.1.0"
path-browserify "1.0.1"
pnp-webpack-plugin "1.6.4"
postcss "8.1.7"
postcss "8.2.13"
process "0.11.10"
prop-types "15.7.2"
querystring-es3 "0.2.1"
Expand Down Expand Up @@ -13731,14 +13721,13 @@ postcss-values-parser@^2.0.1:
indexes-of "^1.0.1"
uniq "^1.0.1"

postcss@8.1.7:
version "8.1.7"
resolved "https://registry.npmjs.org/postcss/-/postcss-8.1.7.tgz#ff6a82691bd861f3354fd9b17b2332f88171233f"
integrity sha512-llCQW1Pz4MOPwbZLmOddGM9eIJ8Bh7SZ2Oj5sxZva77uVaotYDsYTch1WBTNu7fUY0fpWp0fdt7uW40D4sRiiQ==
postcss@8.2.13:
version "8.2.13"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.2.13.tgz#dbe043e26e3c068e45113b1ed6375d2d37e2129f"
integrity sha512-FCE5xLH+hjbzRdpbRb1IMCvPv9yZx2QnDarBEYSN0N0HYk+TcXsEhwdFcFb+SRWOKzKGErhIEbBK2ogyLdTtfQ==
dependencies:
colorette "^1.2.1"
line-column "^1.0.2"
nanoid "^3.1.16"
colorette "^1.2.2"
nanoid "^3.1.22"
source-map "^0.6.1"

postcss@^7.0.14, postcss@^7.0.26, postcss@^7.0.32, postcss@^7.0.35, postcss@^7.0.5, postcss@^7.0.6:
Expand Down