Skip to content

Commit

Permalink
allow sharing configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 22, 2022
1 parent 61878c8 commit 153b2d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
22 changes: 13 additions & 9 deletions docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,25 @@ if (staging) {
console.log(`Staging deploy of ${process.env.REPOSITORY_URL || 'local repository'}`);
}

module.exports = {
const baseline = {
experimental: {
scrollRestoration: true,
},
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
// Motivated by https://github.com/vercel/next.js/issues/7687
ignoreBuildErrors: true,
},
experimental: {
scrollRestoration: true,
},
trailingSlash: true,
// Can be turned on when https://github.com/vercel/next.js/issues/24640 is fixed
optimizeFonts: false,
};

module.exports = {
...baseline,
baseline, // Exported so the other projects can use this configuration directly.
webpack: (config, options) => {
const plugins = config.plugins.slice();

Expand Down Expand Up @@ -182,7 +190,6 @@ module.exports = {
NETLIFY_DEPLOY_URL: process.env.DEPLOY_URL || 'http://localhost:3000',
NETLIFY_SITE_NAME: process.env.SITE_NAME || 'material-ui',
PULL_REQUEST: process.env.PULL_REQUEST === 'true',
REACT_STRICT_MODE: reactStrictMode,
FEEDBACK_URL: process.env.FEEDBACK_URL,
// #default-branch-switch
SOURCE_CODE_ROOT_URL: 'https://github.com/mui/material-ui/blob/master',
Expand Down Expand Up @@ -241,16 +248,13 @@ module.exports = {
return map;
},
reactStrictMode,
trailingSlash: true,
// rewrites has no effect when run `next export` for production
async rewrites() {
rewrites: async () => {
return [
{ source: `/:lang(${LANGUAGES.join('|')})?/:rest*`, destination: '/:rest*' },
// Make sure to include the trailing slash if `trailingSlash` option is set
{ source: '/api/:rest*/', destination: '/api-docs/:rest*/' },
{ source: `/static/x/:rest*`, destination: 'http://0.0.0.0:3001/static/x/:rest*' },
];
},
// Can be turned on when https://github.com/vercel/next.js/issues/24640 is fixed
optimizeFonts: false,
};
13 changes: 1 addition & 12 deletions docs/src/modules/components/ThemeContext.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import {
ThemeProvider as MuiThemeProvider,
createTheme as createLegacyModeTheme,
unstable_createMuiStrictModeTheme as createStrictModeTheme,
} from '@mui/material/styles';
import { ThemeProvider as MuiThemeProvider, createTheme } from '@mui/material/styles';
import { deepmerge } from '@mui/utils';
import useMediaQuery from '@mui/material/useMediaQuery';
import { enUS, zhCN, faIR, ruRU, ptBR, esES, frFR, deDE, jaJP } from '@mui/material/locale';
Expand Down Expand Up @@ -116,13 +112,6 @@ if (process.env.NODE_ENV !== 'production') {
DispatchContext.displayName = 'ThemeDispatchContext';
}

let createTheme;
if (process.env.REACT_STRICT_MODE) {
createTheme = createStrictModeTheme;
} else {
createTheme = createLegacyModeTheme;
}

export function ThemeProvider(props) {
const { children } = props;
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
Expand Down

0 comments on commit 153b2d1

Please sign in to comment.