Skip to content

Commit

Permalink
docs: use node: prefix in example (sveltejs#10486)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored and Elia872 committed Aug 11, 2023
1 parent c5447a2 commit 65ad5ca
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions documentation/faq/60-read-package-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ You cannot directly require JSON files, since SvelteKit expects [`svelte.config.
/// file: svelte.config.js
// @filename: index.js
/// <reference types="@types/node" />
import { URL } from 'url';
import { URL } from 'node:url';
// ---cut---
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';

const file = fileURLToPath(new URL('package.json', import.meta.url));
const json = readFileSync(file, 'utf8');
const pkg = JSON.parse(json);
const path = fileURLToPath(new URL('package.json', import.meta.url));
const pkg = JSON.parse(readFileSync(path, 'utf8'));
```

0 comments on commit 65ad5ca

Please sign in to comment.