2024-02-12 12:58:13 +00:00
|
|
|
/**
|
|
|
|
* @file Configure the Next.js build
|
|
|
|
*
|
|
|
|
* This file gets used by the Next.js build phase, and is not included in the
|
|
|
|
* browser build. It will not be parsed by Webpack, Babel or TypeScript, so
|
|
|
|
* don't use features that will not be available in our target node version.
|
|
|
|
*
|
|
|
|
* https://nextjs.org/docs/pages/api-reference/next-config-js
|
|
|
|
*/
|
|
|
|
|
2023-11-09 04:10:43 +00:00
|
|
|
const { withSentryConfig } = require('@sentry/nextjs');
|
2024-02-10 17:29:04 +00:00
|
|
|
const cp = require('child_process');
|
|
|
|
|
|
|
|
const gitSHA = cp.execSync('git rev-parse --short HEAD', {
|
|
|
|
cwd: __dirname,
|
|
|
|
encoding: 'utf8',
|
|
|
|
});
|
2023-11-09 04:10:43 +00:00
|
|
|
|
2024-02-10 14:14:12 +00:00
|
|
|
const nextConfig = {
|
|
|
|
compiler: {
|
|
|
|
emotion: {
|
|
|
|
importMap: {
|
|
|
|
'@mui/material': {
|
|
|
|
styled: {
|
|
|
|
canonicalImport: ['@emotion/styled', 'default'],
|
|
|
|
styledBaseImport: ['@mui/material', 'styled'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'@mui/material/styles': {
|
|
|
|
styled: {
|
|
|
|
canonicalImport: ['@emotion/styled', 'default'],
|
|
|
|
styledBaseImport: ['@mui/material/styles', 'styled'],
|
2023-11-09 04:10:43 +00:00
|
|
|
},
|
|
|
|
},
|
2023-11-09 04:24:54 +00:00
|
|
|
},
|
2023-11-09 04:10:43 +00:00
|
|
|
},
|
2024-02-10 14:14:12 +00:00
|
|
|
},
|
|
|
|
transpilePackages: ['@mui/material', '@mui/system', '@mui/icons-material'],
|
|
|
|
|
2024-02-12 12:58:13 +00:00
|
|
|
// Add environment variables to the JavaScript bundle. They will be
|
|
|
|
// available as `process.env.VAR_NAME` to our code.
|
|
|
|
env: {
|
|
|
|
GIT_SHA: gitSHA,
|
|
|
|
},
|
|
|
|
|
2024-02-10 14:14:12 +00:00
|
|
|
// https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j
|
|
|
|
webpack: (config, { isServer }) => {
|
|
|
|
if (!isServer) {
|
|
|
|
config.resolve.fallback.fs = false;
|
2023-11-09 04:10:43 +00:00
|
|
|
}
|
2024-02-10 14:14:12 +00:00
|
|
|
return config;
|
|
|
|
},
|
|
|
|
|
|
|
|
// Build time Sentry configuration
|
2024-02-13 05:55:31 +00:00
|
|
|
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
|
2024-02-10 14:14:12 +00:00
|
|
|
sentry: {
|
|
|
|
widenClientFileUpload: true,
|
2024-02-10 16:03:24 +00:00
|
|
|
disableServerWebpackPlugin: true,
|
2024-02-10 14:14:12 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2024-02-13 06:42:48 +00:00
|
|
|
const sentryWebpackPluginOptions = {};
|
|
|
|
|
2024-02-13 05:55:31 +00:00
|
|
|
// withSentryConfig extends the default Next.js usage of webpack to:
|
|
|
|
//
|
|
|
|
// 1. Initialize the SDK on client page load (See `sentry.client.config.ts`)
|
|
|
|
//
|
2024-02-10 17:29:04 +00:00
|
|
|
// 2. Upload sourcemaps (using the settings defined in `sentry.properties`)
|
|
|
|
//
|
|
|
|
// Irritatingly, it insists that we also provide it (empty)
|
|
|
|
// sentry.server.config.ts and sentry.edge.config.ts files too, even though we
|
|
|
|
// are not using those parts.
|
2024-02-13 06:42:48 +00:00
|
|
|
module.exports = withSentryConfig(nextConfig, sentryWebpackPluginOptions);
|