-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
86 lines (78 loc) · 1.92 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
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
const { IgnorePlugin } = require("webpack");
/** @typedef { import('webpack/types').Configuration} WebpackConfig */
const isProd = process.env.NODE_ENV === "production";
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
swcMinify: false,
experimental: !isProd
? {}
: {
swcMinifyDebugOptions: {
mangle: {
keep_classnames: true,
keep_fnames: true,
},
compress: {
defaults: false,
side_effects: false,
},
},
},
/**
* @param {WebpackConfig} config
* @param isServer
* @returns WebpackConfig
*/
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback = {
fs: false,
// path: false,
// "graceful-fs": false,
};
}
config.plugins.push(
new CopyPlugin({
patterns: [
{
from: path.join(
__dirname,
`node_modules/sql.js/dist/sql-wasm${!isProd ? "-debug" : ""}.wasm`
),
to: path.join(__dirname, "/public/dist/sql-wasm.wasm"),
},
{
from: path.join(
__dirname,
`node_modules/sql.js/dist/sql-wasm${!isProd ? "-debug" : ""}.js`
),
to: path.join(__dirname, "/public/dist/sql-wasm.js"),
},
],
}),
new IgnorePlugin({
resourceRegExp: /.+\.md|LICENSE/,
contextRegExp: /cldr-data/,
})
);
config.ignoreWarnings = [
/mongodb/,
/mssql/,
/mysql/,
/mysql2/,
/oracledb/,
/pg/,
/pg-native/,
/pg-query-stream/,
/react-native-sqlite-storage/,
/redis/,
/sqlite3/,
/typeorm-aurora-data-api-driver/,
];
return config;
},
};
module.exports = nextConfig;