forked from placemark/placemark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
75 lines (64 loc) · 1.72 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const { withBlitz } = require("@blitzjs/next");
/* eslint-env node */
/* eslint-disable @typescript-eslint/no-var-requires */
const { withSentryConfig } = require("@sentry/nextjs");
const SentryWebpackPluginOptions = {
silent: true,
};
const isProduction = process.env.NODE_ENV === "production";
/**
* @type {import('@blitzjs/next').BlitzConfig}
**/
let config = {
productionBrowserSourceMaps: true,
compress: false,
swcMinify: true,
// TODO: it would be nice if this worked, but cross-origin
// workers are not a thing yet.
// assetPrefix: isProduction ? "https://static.placemark.io" : "", // "http://0.0.0.0:8787",
webpack(config, options) {
if (process.env.ANALYZE === "true") {
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
// eslint-disable-next-line
config.plugins.push(
// eslint-disable-next-line
new BundleAnalyzerPlugin({
analyzerMode: "static",
generateStatsFile: true,
reportFilename: options.isServer
? "../analyze/server.html"
: "./analyze/client.html",
})
);
}
// eslint-disable-next-line
return config;
},
// eslint-disable-next-line
async headers() {
return [
{
source: "/:path*",
// https://bit.ly/3aWDvYg
headers: [
{
key: "x-frame-options",
value: "frameGuard",
},
{
key: "x-download-options",
value: "noopen",
},
],
},
];
},
poweredByHeader: false,
eslint: {
ignoreDuringBuilds: true,
},
};
if (isProduction) {
config = withSentryConfig(config, SentryWebpackPluginOptions);
}
module.exports = withBlitz(config);