-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
41 lines (38 loc) · 972 Bytes
/
Copy pathnext.config.js
File metadata and controls
41 lines (38 loc) · 972 Bytes
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
const webpack = require("webpack");
const isProduction = process.env.NODE_ENV === "production";
const hideSourceMaps = process.env.NEXT_PUBLIC_HIDE_SOURCE_MAPS === "true";
module.exports = {
i18n: {
locales: ["en"],
defaultLocale: "en"
},
target: "serverless",
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback.fs = false;
}
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: [
{
loader: "@svgr/webpack",
options: { icon: true }
}
]
});
if (isProduction && hideSourceMaps) {
if (!isServer) {
config.devtool = false; // Disable sourcemaps on client-side
}
config.plugins.push(
new webpack.SourceMapDevToolPlugin({
filename: "hidden-source-maps/[file].map",
noSources: true,
test: /\.(js|css|map)($|\?)/i
})
);
}
return config;
}
};