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

meta: added million.js compiler (react) and updated packages #6475

Closed
wants to merge 2 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

import { withSentryConfig } from '@sentry/nextjs';
import million from 'million/compiler';
import withNextIntl from 'next-intl/plugin';

import { BASE_PATH, ENABLE_STATIC_EXPORT } from './next.constants.mjs';
Expand All @@ -14,6 +15,9 @@ import {

/** @type {import('next').NextConfig} */
const nextConfig = {
// We want to enforce React to run within its strict mode
// This is a requirement for Million.js
reactStrictMode: true,
// We intentionally disable Next.js's built-in i18n support
// as we dom have our own i18n and internationalisation engine
i18n: null,
Expand All @@ -27,6 +31,8 @@ const nextConfig = {
// We allow the BASE_PATH to be overridden in case that the Website
// is being built on a subdirectory (e.g. /nodejs-website)
basePath: BASE_PATH,
// Numerous next/image specific configurations based on security
// and optimisation policies for the Node.js website
images: {
// We disable image optimisation during static export builds
unoptimized: ENABLE_STATIC_EXPORT,
Expand Down Expand Up @@ -127,10 +133,13 @@ const sentryConfig = {
// Next.js Configuration with `next.intl` enabled
const nextWithIntl = withNextIntl('./i18n.tsx')(nextConfig);

// Enables Million.js React Compiler for Next.js
const nextWithMillion = million.next(nextWithIntl, { auto: true, rsc: true });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const nextWithMillion = million.next(nextWithIntl, { auto: true, rsc: true });
const nextWithMillion = million.next(nextWithIntl, {
// support react server components
auto: { rsc: true },
// We don't want to send telemetry data to Million
telemetry: false,
});

docs ref for rsc
docs ref for telemetry


// Next.js Configuration with `sentry` enabled
const nextWithSentry = withSentryConfig(
// Next.js Config with i18n Configuration
nextWithIntl,
// Next.js Config with i18n Middlewares and Million.js
nextWithMillion,
// Default Sentry Settings
sentrySettings,
// Default Sentry Extension Configuration
Expand Down
Loading
Loading