-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
129 lines (121 loc) · 4.57 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/** @type {import('next').NextConfig} */
// const path = require("path");
// const os = require("os");
// {
// target: "node",
// output: {
// libraryTarget: "commonjs2"
// },
// module: {
// rules: [
// {
// // For node binary relocations, include ".node" files as well here
// test: /\.(m?js|node)$/,
// // it is recommended for Node builds to turn off AMD support
// parser: { amd: false },
// use: {
// loader: '@vercel/webpack-asset-relocator-loader',
// options: {
// // optional, base folder for asset emission (eg assets/name.ext)
// outputAssetBase: 'assets',
// // optional, restrict asset emissions to only the given folder.
// filterAssetBase: process.cwd(),
// // optional, permit entire __dirname emission
// // eg `const nonAnalyzable = __dirname` can emit everything in the folder
// emitDirnameAll: false,
// // optional, permit entire filterAssetBase emission
// // eg `const nonAnalyzable = process.cwd()` can emit everything in the cwd()
// emitFilterAssetBaseAll: false,
// // optional, custom functional asset emitter
// // takes an asset path and returns the replacement
// // or returns false to skip emission
// customEmit: (path, { id, isRequire }) => false | '"./custom-replacement"',
// // optional, a list of asset names already emitted or
// // defined that should not be emitted
// existingAssetNames: [],
// wrapperCompatibility: false, // optional, default
// // build for process.env.NODE_ENV = 'production'
// production: true, // optional, default is undefined
// cwd: process.cwd(), // optional, default
// debugLog: false, // optional, default
// }
// }
// }
// ]
// }
// }
// const path = require("path");
//
// const nextConfig = {
// webpack: (config, { dev, isServer, webpack, nextRuntime }) => {
// config.module.rules.push({
// test: /\.node$/,
// loader: "node-loader",
// options: {
// name: "[path][name].[ext]",
// flags: os.constants.dlopen.RTLD_NOW,
// },
// });
// return config;
// },
// };
// const nextConfig = {
// webpack: (config, { dev, isServer, webpack, nextRuntime }) => {
// config.node = {
// global: true,
// __filename: true,
// __dirname: true,
// };
// config.module.rules.push({
// test: /\.(node)$/,
// parser: { amd: false },
// use: {
// loader: "@vercel/webpack-asset-relocator-loader",
// options: {
// // optional, base folder for asset emission (eg assets/name.ext)
// // outputAssetBase: "chunks",
// // optional, restrict asset emissions to only the given folder.
// filterAssetBase: process.cwd(),
// // optional, permit entire __dirname emission
// // eg `const nonAnalyzable = __dirname` can emit everything in the folder
// // emitDirnameAll: true,
// // optional, permit entire filterAssetBase emission
// // eg `const nonAnalyzable = process.cwd()` can emit everything in the cwd()
// // emitFilterAssetBaseAll: false,
// // // optional, custom functional asset emitter
// // // takes an asset path and returns the replacement
// // // or returns false to skip emission
// // customEmit: (path, { id, isRequire }) =>
// customEmit: (path, { id, isRequire }) => {
// console.log("\nWHAT THE NUTS\n");
// return "./test"
// },
// // false | '"./custom-replacement"',
// // // optional, a list of asset names already emitted or
// // // defined that should not be emitted
// // existingAssetNames: [],
// // wrapperCompatibility: false, // optional, default
// // // build for process.env.NODE_ENV = 'production'
// production: true, // optional, default is undefined
// // cwd: process.cwd(), // optional, default
// debugLog: true, // optional, default
// },
// },
// });
// return config;
// },
// };
const nextConfig = {
webpack: (config, { dev, isServer, webpack, nextRuntime }) => {
config.module.rules.push({
test: /\.node$/,
use: [
{
loader: "nextjs-node-loader",
},
],
});
return config;
},
};
module.exports = nextConfig;