generated from timlrx/tailwind-nextjs-starter-blog
-
Notifications
You must be signed in to change notification settings - Fork 27
/
next.config.js
95 lines (87 loc) · 2.37 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
// const withPWA = require("next-pwa");
// const runtimeCaching = require("next-pwa/cache");
const { withSentryConfig } = require("@sentry/nextjs");
const SentryWebpackPluginOptions = {
silent: true,
};
const isDevelopment = process.env.NODE_ENV === "development";
// @ts-check
/**
* @type {import('next').NextConfig}
**/
const nextConfig = {
// swcMinify: true,
reactStrictMode: true,
pageExtensions: ["ts", "tsx", "md", "mdx"],
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
images: {
domains: [
// project hero
"images.unsplash.com",
// cms assets
"www.datocms-assets.com",
// twitter profile picture
"pbs.twimg.com",
// google avatar
"lh3.googleusercontent.com",
// github avatar
"avatars.githubusercontent.com",
// line avatar
"profile.line-scdn.net",
],
},
// pwa: {
// dest: "public",
// runtimeCaching,
// disable: isDevelopment,
// mode: "production",
// buildExcludes: [
// /middleware-manifest\.json$/,
// /middleware-runtime\.js$/,
// /middleware-runtime\.js.map$/,
// /middleware\.js$/,
// /middleware\.js.map$/,
// ],
// },
webpack: (config, { dev, isServer }) => {
config.module.rules.push({
test: /\.(png|jpe?g|gif|mp4)$/i,
use: [
{
loader: "file-loader",
options: {
publicPath: "/_next",
name: "static/media/[name].[hash].[ext]",
},
},
],
});
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
});
// if (!dev && !isServer) {
// // Replace React with Preact only in client production build
// Object.assign(config.resolve.alias, {
// "react/jsx-runtime.js": "preact/compat/jsx-runtime",
// react: "preact/compat",
// "react-dom/test-utils": "preact/test-utils",
// "react-dom": "preact/compat",
// });
// }
return config;
},
// experimental: { appDir: true },
};
module.exports = isDevelopment
? nextConfig
: withSentryConfig(withBundleAnalyzer(nextConfig), SentryWebpackPluginOptions);