forked from latentcat/latentbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
89 lines (83 loc) · 2.23 KB
/
next.config.mjs
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
import createNextIntlPlugin from "next-intl/plugin";
import createNextMDXPlugin from "@next/mdx";
import NextBundleAnalyzer from "@next/bundle-analyzer";
import rehypeShiki from "@shikijs/rehype";
const withNextIntl = createNextIntlPlugin();
const withMDX = createNextMDXPlugin({
options: {
rehypePlugins: [
[
rehypeShiki,
{
themes: {
light: "vitesse-light",
dark: "vitesse-dark",
},
defaultColor: false,
},
],
],
},
});
const withBundleAnalyzer = NextBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**.githubusercontent.com",
port: "",
pathname: "**",
},
],
},
async rewrites() {
return [
{
source: "/mp/lib.min.js",
destination: "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js",
},
{
source: "/mp/lib.js",
destination: "https://cdn.mxpnl.com/libs/mixpanel-2-latest.js",
},
{
source: "/mp/decide",
destination: "https://decide.mixpanel.com/decide",
},
{
source: "/mp/:slug",
// use "api-eu.mixpanel.com" if you need to use EU servers
destination: "https://api.mixpanel.com/:slug",
},
];
},
webpack: (config) => {
// https://github.com/vercel/next.js/discussions/36981
config.module.generator["asset/resource"] =
config.module.generator["asset"];
config.module.generator["asset/source"] = config.module.generator["asset"];
delete config.module.generator["asset"];
const imageLoaderRule = config.module.rules.find(
(rule) => rule.loader === "next-image-loader",
);
imageLoaderRule.exclude = /\.inline\.(png|jpg|svg)$/i;
config.module.rules = [
...config.module.rules,
{
test: /\.inline\.(png|jpg|gif)$/i,
type: "asset/inline",
},
{
test: /\.all-contributorsrc/,
type: "json",
},
];
return config;
},
};
export default withBundleAnalyzer(withNextIntl(withMDX(nextConfig)));