Skip to content

Commit d0c5f2a

Browse files
authored
feat(docs)!: bump node to v18 (#1643)
1 parent 9a278c9 commit d0c5f2a

File tree

10 files changed

+40119
-24690
lines changed

10 files changed

+40119
-24690
lines changed

.github/workflows/commitlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Node.js
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: "14.20.0"
18+
node-version: "18.17.0"
1919

2020
- name: Install dependencies
2121
run: npm ci

.husky/commit-msg

Lines changed: 0 additions & 4 deletions
This file was deleted.

.husky/pre-commit

Lines changed: 0 additions & 14 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v14.20.0
1+
18

netlify.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
[[plugins]]
22
package = "@netlify/plugin-nextjs"
3-
4-
[[plugins]]
5-
package = "netlify-plugin-cache-nextjs"
63

74
[build.environment]
8-
NODE_OPTIONS = "--max_old_space_size=7168"
5+
NODE_VERSION = "18"
6+
NODE_OPTIONS = "--max_old_space_size=7168 --openssl-legacy-provider"
97

108
# Production context: all deploys from the Production branch set in your site’s
119
# deploy contexts will inherit these settings.
1210
[context.production]
1311
publish = ".next/"
1412
command = "npm run build"
15-
environment = { NODE_VERSION = "14.20.0" }
1613

1714

1815
# Deploy Preview context: all deploys generated from a pull/merge request will
1916
# inherit these settings.
2017
[context.deploy-preview]
2118
publish = ".next/"
2219
command = "npm run build"
23-
environment = { NODE_VERSION = "14.20.0", NEXT_PUBLIC_DEPLOY_PREVIEW = "TRUE" }
20+
environment = { NEXT_PUBLIC_DEPLOY_PREVIEW = "TRUE" }

next.config.js

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,58 @@ const withYaml = require("next-plugin-yaml");
55
const nextConfig = {
66
target: "serverless",
77
basePath: process.env.CONTEXT === "deploy-preview" ? "" : "/docs",
8+
webpack: (config, { dev }) => {
9+
if (!dev) {
10+
config.devtool = false;
11+
const setSourceMapFalse = (rules) => {
12+
if (!rules) return;
13+
for (const rule of rules) {
14+
if (rule.oneOf) setSourceMapFalse(rule.oneOf);
15+
else if (rule.use) {
16+
const uses = Array.isArray(rule.use) ? rule.use : [rule.use];
17+
for (const u of uses) {
18+
const loader = typeof u === "string" ? u : u && u.loader;
19+
if (
20+
loader &&
21+
(loader.includes("css-loader") ||
22+
loader.includes("postcss-loader"))
23+
) {
24+
if (typeof u === "object" && u.options) {
25+
u.options.sourceMap = false;
26+
if (u.options.postcssOptions && u.options.postcssOptions.map)
27+
u.options.postcssOptions.map = false;
28+
}
29+
}
30+
}
31+
} else if (
32+
rule.loader &&
33+
(rule.loader.includes("css-loader") ||
34+
rule.loader.includes("postcss-loader")) &&
35+
rule.options
36+
) {
37+
rule.options.sourceMap = false;
38+
}
39+
}
40+
};
41+
setSourceMapFalse(config.module.rules);
42+
const minimizers = config.optimization && config.optimization.minimizer;
43+
if (Array.isArray(minimizers)) {
44+
for (const m of minimizers) {
45+
if (
46+
m &&
47+
m.constructor &&
48+
m.constructor.name === "CssMinimizerPlugin" &&
49+
m.options
50+
) {
51+
if (!m.options.postcssOptions) m.options.postcssOptions = {};
52+
m.options.postcssOptions.map = false;
53+
break;
54+
}
55+
}
56+
}
57+
}
58+
return config;
59+
},
860
};
961

1062
module.exports = withPlugins(
@@ -27,5 +79,5 @@ module.exports = withPlugins(
2779
],
2880
[withYaml],
2981
],
30-
nextConfig
82+
nextConfig,
3183
);

0 commit comments

Comments
 (0)