Skip to content

Commit 23076b8

Browse files
committed
fix(vercel): remove dependency of fs-extra
nuxt#565
1 parent adcba63 commit 23076b8

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"@nuxt/kit": "^3.0.0-rc.4",
2828
"consola": "^2.15.3",
2929
"defu": "^6.0.0",
30-
"fs-extra": "^10.1.0",
3130
"h3": "^0.7.10",
3231
"image-meta": "^0.1.1",
3332
"node-fetch-native": "^0.1.4",

src/provider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { promises as fsp } from 'fs'
12
import { normalize, resolve, dirname } from 'pathe'
23
import { createResolver, resolvePath } from '@nuxt/kit'
3-
import * as fse from 'fs-extra'
44
import { hash } from 'ohash'
55
import type { InputProvider, ImageModuleProvider, ProviderSetup } from './types'
66
import type { ModuleOptions } from './module'
@@ -37,11 +37,11 @@ export const providerSetup: Record<string, ProviderSetup> = {
3737
// https://vercel.com/docs/more/adding-your-framework#images
3838
async vercel (_providerOptions, moduleOptions, nuxt) {
3939
const imagesConfig = resolve(nuxt.options.rootDir, '.vercel_build_output/config/images.json')
40-
await fse.mkdirp(dirname(imagesConfig))
41-
await fse.writeJson(imagesConfig, {
40+
await fsp.mkdir(dirname(imagesConfig), { recursive: true })
41+
await fsp.writeFile(imagesConfig, JSON.stringify({
4242
domains: moduleOptions.domains,
4343
sizes: Array.from(new Set(Object.values(moduleOptions.screens || {})))
44-
})
44+
}, null, 2))
4545
}
4646
}
4747

0 commit comments

Comments
 (0)