2020-10-03 14:21:56 +00:00
|
|
|
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
|
|
|
enabled: process.env.ANALYZE === 'true',
|
|
|
|
});
|
2021-06-15 19:07:01 +00:00
|
|
|
const withWorkbox = require('@ente-io/next-with-workbox');
|
2020-09-19 21:20:10 +00:00
|
|
|
|
2021-06-07 10:45:46 +00:00
|
|
|
const { withSentryConfig } = require('@sentry/nextjs');
|
2021-03-08 11:59:14 +00:00
|
|
|
|
2021-06-15 09:07:32 +00:00
|
|
|
const cp = require('child_process');
|
|
|
|
const gitSha = cp.execSync('git rev-parse --short HEAD', {
|
|
|
|
cwd: __dirname,
|
|
|
|
encoding: 'utf8',
|
|
|
|
});
|
2021-03-08 11:59:14 +00:00
|
|
|
|
2021-08-26 08:06:03 +00:00
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
const COOP_COEP_Headers = [
|
|
|
|
{
|
|
|
|
key: 'Cross-Origin-Opener-Policy',
|
|
|
|
value: 'same-origin',
|
2021-06-07 08:51:43 +00:00
|
|
|
},
|
2021-08-26 08:06:03 +00:00
|
|
|
{
|
|
|
|
key: 'Cross-Origin-Embedder-Policy',
|
|
|
|
value: 'require-corp',
|
2021-06-10 04:28:29 +00:00
|
|
|
},
|
2021-08-26 08:06:03 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
module.exports = withSentryConfig(
|
|
|
|
withWorkbox(
|
|
|
|
withBundleAnalyzer({
|
|
|
|
future: {
|
|
|
|
webpack5: true,
|
|
|
|
},
|
|
|
|
env: {
|
|
|
|
SENTRY_RELEASE: gitSha,
|
|
|
|
},
|
|
|
|
workbox: {
|
|
|
|
swSrc: 'src/serviceWorker.js',
|
|
|
|
exclude: [/manifest\.json$/i],
|
|
|
|
},
|
|
|
|
webpack: (config) => {
|
|
|
|
config.output.hotUpdateMainFilename =
|
|
|
|
'static/webpack/[fullhash].[runtime].hot-update.json';
|
|
|
|
return config;
|
|
|
|
},
|
|
|
|
|
|
|
|
async headers() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
// Apply these headers to all routes in your application.
|
|
|
|
source: '/(.*)',
|
|
|
|
headers: COOP_COEP_Headers,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
},
|
|
|
|
})
|
|
|
|
),
|
|
|
|
{ release: gitSha }
|
|
|
|
);
|