run only for non server webpack

This commit is contained in:
Abhinav 2021-12-03 19:01:53 +05:30
parent 28dd87b35b
commit 82a15ef66d

View file

@ -3,7 +3,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
});
const withWorkbox = require('@ente-io/next-with-workbox');
const { withSentryConfig } = require('@sentry/nextjs');
// const { withSentryConfig } = require('@sentry/nextjs');
const cp = require('child_process');
const gitSha = cp.execSync('git rev-parse --short HEAD', {
@ -15,57 +15,60 @@ const { createSecureHeaders } = require('next-secure-headers');
const { SubresourceIntegrityPlugin } = require('webpack-subresource-integrity');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = withSentryConfig(
withWorkbox(
withBundleAnalyzer({
env: {
SENTRY_RELEASE: gitSha,
},
workbox: {
swSrc: 'src/serviceWorker.js',
exclude: [/manifest\.json$/i],
},
module.exports = withWorkbox(
// withSentryConfig(
withBundleAnalyzer({
env: {
SENTRY_RELEASE: gitSha,
},
workbox: {
swSrc: 'src/serviceWorker.js',
exclude: [/manifest\.json$/i],
},
// added header for local testing only as they are not exported with the app
headers() {
return [
{
// Apply these headers to all routes in your application....
source: '/(.*)',
headers: [
...createSecureHeaders({
contentSecurityPolicy: {
directives: {
defaultSrc: "'none'",
imgSrc: "'self' blob:",
styleSrc: "'self' 'unsafe-inline'",
fontSrc: "'self'",
scriptSrc: "'self' 'unsafe-eval'",
connectSrc:
"'self' https://api.ente.io data:",
reportURI:
'https://csp-reporter.ente.workers.dev',
reportTo:
'https://csp-reporter.ente.workers.dev',
},
// added header for local testing only as they are not exported with the app
headers() {
return [
{
// Apply these headers to all routes in your application....
source: '/(.*)',
headers: [
...createSecureHeaders({
contentSecurityPolicy: {
directives: {
defaultSrc: "'none'",
imgSrc: "'self' blob:",
styleSrc: "'self' 'unsafe-inline'",
fontSrc: "'self'",
scriptSrc: "'self' 'unsafe-eval'",
connectSrc:
"'self' https://api.ente.io data:",
reportURI:
'https://csp-reporter.ente.workers.dev',
reportTo:
'https://csp-reporter.ente.workers.dev',
},
}),
],
},
];
},
// 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;
}
},
}),
],
},
];
},
// 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;
config.output.crossOriginLoading = 'anonymous';
config.plugins = config.plugins || [];
config.plugins.push(new HtmlWebpackPlugin());
config.plugins.push(new SubresourceIntegrityPlugin());
return config;
},
})
),
{ release: gitSha }
config.plugins.push(
new SubresourceIntegrityPlugin({ enabled: true })
);
}
return config;
},
})
);
/* { release: gitSha }
);*/