Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 755058d

Browse files
authored
fix: use fs read instead of JSON import (#105)
1 parent e21ffd2 commit 755058d

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

.changeset/fluffy-spoons-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/netlify': patch
3+
---
4+
5+
fix crash when reading package.json version field

packages/netlify/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import type { Context } from '@netlify/functions';
55
import type { AstroConfig, AstroIntegration, RouteData } from 'astro';
66
import { AstroError } from 'astro/errors';
77
import { build } from 'esbuild';
8-
import { appendFile, mkdir, rm, writeFile } from 'fs/promises';
9-
import { version as packageVersion } from '../package.json';
8+
import { appendFile, mkdir, rm, writeFile, readFile } from 'fs/promises';
9+
10+
const { version: packageVersion } = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
1011

1112
export interface NetlifyLocals {
1213
netlify: {

0 commit comments

Comments
 (0)