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

Updated Next.js to 13.1.2 #1627

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
File renamed without changes.
106 changes: 58 additions & 48 deletions packages/www/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { withSentryConfig } = require("@sentry/nextjs");
const withPlugins = require("next-compose-plugins");
const emoji = require("remark-emoji");
const withMDX = require("@next/mdx")({
options: {
Expand All @@ -9,26 +8,25 @@ const withMDX = require("@next/mdx")({

const isAnalyzeEnabled = process.env.ANALYZE === "true";

const SentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore

const sentryWebpackPluginOptions = {
silent: true, // Suppresses all logs
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};

const config = {
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
images: {
domains: ["cdn.sanity.io", "picsum.photos"],
},
i18n: {
locales: ["en", "es"],
defaultLocale: "en",
},
sentry: {
hideSourceMaps: false,
},
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx", "svg"],
async redirects() {
return [
{
Expand Down Expand Up @@ -233,40 +231,52 @@ const config = {
},
};

module.exports = withSentryConfig(
withPlugins(
[
[
withMDX,
{
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx", "svg"],
webpack(config, _options) {
config.module.rules.push({
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: "graphql-tag/loader",
});
config.module.rules.push({
test: /\.md$/,
use: "raw-loader",
});
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
});
if (isAnalyzeEnabled) {
const DuplicatePackageCheckerPlugin = require("duplicate-package-checker-webpack-plugin");
config.plugins.push(new DuplicatePackageCheckerPlugin());
}
return config;
},
},
],
...(isAnalyzeEnabled
? [require("@next/bundle-analyzer")({ enabled: isAnalyzeEnabled })]
: []),
],
config
),
SentryWebpackPluginOptions
);
/**
* @type {import('@next/mdx').NextMDXOptions}
*/
const mdxOptions = {
webpack(config, _options) {
config.module.rules.push({
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: "graphql-tag/loader",
});
config.module.rules.push({
test: /\.md$/,
use: "raw-loader",
});
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
});
if (isAnalyzeEnabled) {
const DuplicatePackageCheckerPlugin = require("duplicate-package-checker-webpack-plugin");
config.plugins.push(new DuplicatePackageCheckerPlugin());
}
return config;
},
};

const bundleAnalyzer = require("@next/bundle-analyzer")({
enabled: isAnalyzeEnabled,
});

module.exports = (phase, defaultConfig) => {
const plugins = [
(config) => withSentryConfig(config, sentryWebpackPluginOptions),
(config) => withMDX({ ...config, ...mdxOptions }),
bundleAnalyzer,
];

const config = plugins.reduce(
(acc, plugin) => {
const update = plugin(acc);
return typeof update === "function"
? update(phase, defaultConfig)
: update;
},
{ ...nextConfig }
);

return config;
};
13 changes: 6 additions & 7 deletions packages/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
"@livepeer.studio/api": "^0.12.0",
"@livepeer/design-system": "^1.0.4",
"@livepeer/react": "^2.1.0",
"@mdx-js/loader": "^1.6.16",
"@mdx-js/mdx": "^1.6.16",
"@mdx-js/react": "^1.6.16",
"@mdx-js/loader": "^2.2.1",
"@mdx-js/mdx": "^2.2.1",
"@mdx-js/react": "^2.2.1",
"@mdx-js/tag": "^0.20.3",
"@next/mdx": "^9.5.2",
"@next/mdx": "^13.1.3",
"@portabletext/react": "^2.0.0",
"@radix-ui/react-accordion": "^0.1.7-rc.7",
"@radix-ui/react-collapsible": "^0.1.6",
Expand Down Expand Up @@ -70,11 +70,10 @@
"metamask-react": "^2.3.0",
"moment": "^2.24.0",
"mux-embed": "^4.15.0",
"next": "^13.0.4",
"next-compose-plugins": "^2.2.0",
"next": "^13.1.3",
"next-mdx": "^0.6.0",
"next-seo": "^4.4.0",
"next-sitemap": "^2.5.20",
"next-sitemap": "^3.1.47",
"next-themes": "^0.2.0",
"numeral": "^2.0.6",
"parse-numeric-range": "^1.2.0",
Expand Down