-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnext.config.mjs
100 lines (86 loc) · 2.67 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
90
91
92
93
94
95
96
97
98
99
100
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
async rewrites() {
if (process.env.NODE_ENV === "development") {
return [
{
source: "/devapi/:path*",
// destination: `${process.env.NEXT_PUBLIC_BASE_URL}/dev/:path*/`,
destination: `http://localhost:3456/devapi/:path*`,
},
];
} else {
return [];
}
},
trailingSlash: false,
images: {},
webpack: (config, { isServer }) => {
// let found = config.module.rules.filter(ru => {
// if (ru.use.some(u => u.includes('post'))) {
// return true
// }
// return false
// })
// console.log(found)
// config.module.rules.push({
// test: /\.css$/i,
// use: ["style-loader", "css-loader", "postcss-loader"],
// })
// console.log(config.module.rules)
config.module.rules = config.module.rules.filter((rule) => {
return rule.loader !== "next-image-loader";
});
// config.module.rules.push({
// test: /\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i,
// exclude: /node_modules/,
// use: [
// {
// //${config.assetPrefix}
// loader: 'file-loader',
// options: {
// limit: 0, /// config.inlineImageLimit,
// fallback: 'file-loader',
// publicPath: `/_next/static/images/`,
// outputPath: `${isServer ? '../' : ''}static/images/`,
// name: '[name]-[hash].[ext]',
// esModule: config.esModule || false,
// },
// },
// ],
// })
config.module.rules.push({
test: /\.(glb|gltf|hdr|exr|fbx|ttf|png|jpg|jpeg|gif|webp|avif|ico|bmp|svg|mov|mp4|task|wasm|webm)$/,
exclude: /node_modules/,
use: [
{
//${config.assetPrefix}
loader: "file-loader",
options: {
limit: 0, /// config.inlineImageLimit,
fallback: "file-loader",
publicPath: `/_next/static/images/`,
outputPath: `${isServer ? "../" : ""}static/images/`,
name: "[name]-[hash].[ext]",
esModule: config.esModule || false,
},
},
],
});
// shader support
config.module.rules.push({
test: /\.(glsl|vs|fs|vert|frag)$/,
exclude: /node_modules/,
use: ["raw-loader", "glslify-loader"],
});
config.experiments = config.experiments || {};
config.experiments.topLevelAwait = true;
// config.experiments.outputModule = true;
config.output.environment = config.output.environment || {};
config.output.environment.asyncFunction = true;
return config;
},
//
};
export default nextConfig;