Unverified Commit a5fab848 authored by Steven's avatar Steven Committed by GitHub

Reduce install size for linux glibc/musl (#32850)

In Next.js [12.0.1](
https://packagephobia.com/result?p=next@12.0.1), musl support was added which caused linux to install both glibc and musl binaries.

This PR adds the `install` script to prevent installing unused binaries, reducing the install size by 47MB.

We originally thought this could be added to Node.js core and thus npm but [it was rejected](https://github.com/nodejs/node/pull/41338).

Note getReport() works on Node.js [`>=11.8.0`](https://nodejs.org/api/process.html#processreportgetreporterr) which is safe to use since Next.js requires [`"node": ">=12.22.0"`](https://github.com/vercel/next.js/blob/265f71e225ed18fcb099c28cf1b5c83519acc3b0/packages/next/package.json#L280).
parent d0e72fd9
const { glibcVersionRuntime } = process.report.getReport().header;
process.exit(glibcVersionRuntime ? 0 : 1);
\ No newline at end of file
...@@ -9,8 +9,12 @@ ...@@ -9,8 +9,12 @@
], ],
"main": "next-swc.linux-arm64-gnu.node", "main": "next-swc.linux-arm64-gnu.node",
"files": [ "files": [
"next-swc.linux-arm64-gnu.node" "next-swc.linux-arm64-gnu.node",
"install.js"
], ],
"scripts": {
"install": "node install.js"
},
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">= 10" "node": ">= 10"
......
const { glibcVersionRuntime } = process.report.getReport().header;
process.exit(glibcVersionRuntime ? 1 : 0);
\ No newline at end of file
...@@ -9,8 +9,12 @@ ...@@ -9,8 +9,12 @@
], ],
"main": "next-swc.linux-arm64-musl.node", "main": "next-swc.linux-arm64-musl.node",
"files": [ "files": [
"next-swc.linux-arm64-musl.node" "next-swc.linux-arm64-musl.node",
"install.js"
], ],
"scripts": {
"install": "node install.js"
},
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">= 10" "node": ">= 10"
......
const { glibcVersionRuntime } = process.report.getReport().header;
process.exit(glibcVersionRuntime ? 0 : 1);
\ No newline at end of file
...@@ -9,8 +9,12 @@ ...@@ -9,8 +9,12 @@
], ],
"main": "next-swc.linux-x64-gnu.node", "main": "next-swc.linux-x64-gnu.node",
"files": [ "files": [
"next-swc.linux-x64-gnu.node" "next-swc.linux-x64-gnu.node",
"install.js"
], ],
"scripts": {
"install": "node install.js"
},
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">= 10" "node": ">= 10"
......
const { glibcVersionRuntime } = process.report.getReport().header;
process.exit(glibcVersionRuntime ? 1 : 0);
\ No newline at end of file
...@@ -9,8 +9,12 @@ ...@@ -9,8 +9,12 @@
], ],
"main": "next-swc.linux-x64-musl.node", "main": "next-swc.linux-x64-musl.node",
"files": [ "files": [
"next-swc.linux-x64-musl.node" "next-swc.linux-x64-musl.node",
"install.js"
], ],
"scripts": {
"install": "node install.js"
},
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">= 10" "node": ">= 10"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment