Skip to content

Commit

Permalink
fix: node v18 support (#7812)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Apr 22, 2022
1 parent ba43c29 commit fc89057
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 44 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -27,12 +27,17 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node_version: [12, 14, 16, 17]
node_version: [12, 14, 16, 17, 18]
include:
- os: macos-latest
node_version: 16
- os: macos-latest
node_version: 18
- os: windows-latest
node_version: 16
# Maybe bug with jest on windows and node-v18
# - os: windows-latest
# node_version: 18
fail-fast: false

name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -37,7 +37,7 @@
"@microsoft/api-extractor": "^7.22.2",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.4.1",
"@types/node": "^16.11.27",
"@types/node": "^17.0.25",
"@types/prompts": "^2.0.14",
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "^5.20.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/package.json
Expand Up @@ -71,7 +71,7 @@
"@types/less": "^3.0.3",
"@types/micromatch": "^4.0.2",
"@types/mime": "^2.0.3",
"@types/node": "^16.11.27",
"@types/node": "^17.0.25",
"@types/resolve": "^1.20.1",
"@types/sass": "~1.43.1",
"@types/stylus": "^0.48.37",
Expand Down
10 changes: 9 additions & 1 deletion packages/vite/src/node/logger.ts
Expand Up @@ -190,7 +190,15 @@ function printServerUrls(
} else {
Object.values(os.networkInterfaces())
.flatMap((nInterface) => nInterface ?? [])
.filter((detail) => detail && detail.address && detail.family === 'IPv4')
.filter(
(detail) =>
detail &&
detail.address &&
// Node < v18
((typeof detail.family === 'string' && detail.family === 'IPv4') ||
// Node >= v18
(typeof detail.family === 'number' && detail.family === 4))
)
.map((detail) => {
const type = detail.address.includes('127.0.0.1')
? 'Local: '
Expand Down
80 changes: 40 additions & 40 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fc89057

Please sign in to comment.