Skip to content

Commit e7536b6

Browse files
authored
FE-348: Update Next to 12.2 and use SWC instead of Babel (#7291)
1 parent 3a67424 commit e7536b6

File tree

6 files changed

+301
-28
lines changed

6 files changed

+301
-28
lines changed

.babelrc

Lines changed: 0 additions & 15 deletions
This file was deleted.

next.config.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
const { patchWebpackConfig } = require("next-global-css");
22
const transpileModules = require("next-transpile-modules");
33
const { RetryChunkLoadPlugin } = require("webpack-retry-chunk-load-plugin");
4+
const withPlugins = require("next-compose-plugins");
5+
6+
const withBundleAnalyzer = require("@next/bundle-analyzer")({
7+
enabled: process.env.ANALYZE === "true",
8+
});
49

510
const withTM = transpileModules(["bvaughn-architecture-demo"]);
611

712
const baseNextConfig = {
813
// bumping Next from 12.0.9 to 12.1.0 required this as a temp WAR
914
// (see https://github.com/vercel/next.js/pull/34500)
10-
experimental: {},
15+
experimental: {
16+
browsersListForSwc: true,
17+
},
1118

1219
eslint: {
1320
// which folders to run ESLint on during production builds (next build)
@@ -149,4 +156,4 @@ const baseNextConfig = {
149156
},
150157
};
151158

152-
module.exports = withTM(baseNextConfig);
159+
module.exports = withPlugins([withTM, withBundleAnalyzer], baseNextConfig);

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"logrocket": "^2.2.1",
7070
"logrocket-react": "^5.0.1",
7171
"mixpanel-browser": "^2.43.0",
72-
"next": "^12.1.6",
72+
"next": "^12.2",
7373
"next-global-css": "^1.3.1",
7474
"parse-script-tags": "^0.1.7",
7575
"polished": "^4.2.2",
@@ -117,6 +117,7 @@
117117
"@babel/preset-typescript": "^7.15.0",
118118
"@babel/types": "^7.14.8",
119119
"@jest/console": "^28.0.2",
120+
"@next/bundle-analyzer": "^12.2.0",
120121
"@recordreplay/playwright": "^1.18.3",
121122
"@recordreplay/sourcemap-upload-cli": "^0.1.1",
122123
"@replayio/playwright": "^0.2.1",
@@ -185,6 +186,7 @@
185186
"jest-environment-jsdom": "^28.0.2",
186187
"jest-in-case": "^1.0.2",
187188
"mini-css-extract-plugin": "^2.6.0",
189+
"next-compose-plugins": "^2.2.1",
188190
"node-polyfill-webpack-plugin": "^1.1.4",
189191
"postcss": "^8.4.12",
190192
"postcss-loader": "^6.2.1",
@@ -206,7 +208,7 @@
206208
"webpack-retry-chunk-load-plugin": "^3.0.0"
207209
},
208210
"browserslist": [
209-
"defaults"
211+
"chrome 95"
210212
],
211213
"repository": {
212214
"type": "git",

pages/api/browser/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async function initAuthRequest(key: string) {
4444
}
4545

4646
export default async (req: NextApiRequest, res: NextApiResponse) => {
47-
const key = getQueryValue(req.query.key);
47+
const key = getQueryValue(req.query.key!);
4848
if (!key) {
4949
res.statusCode = 400;
5050
res.statusMessage = "Missing parameter";

pages/api/browser/callback.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ async function fetchToken(code: string, verifier: string): Promise<Token> {
8484
}
8585

8686
function redirectToLogin(req: NextApiRequest, res: NextApiResponse) {
87-
const message = getQueryValue(req.query.error_description);
87+
const message = getQueryValue(req.query.error_description!);
8888

8989
res.redirect("/browser/error?type=auth&message=" + encodeURIComponent(message));
9090
}
9191

9292
export default async (req: NextApiRequest, res: NextApiResponse) => {
93-
const code = getQueryValue(req.query.code);
94-
const state = getQueryValue(req.query.state);
93+
const code = getQueryValue(req.query.code!);
94+
const state = getQueryValue(req.query.state!);
9595
const browserAuth = req.cookies["replay-browser-auth"];
9696

9797
if (!code || !state || !browserAuth) {

0 commit comments

Comments
 (0)