mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
feat: make cloudflare working
This commit is contained in:
parent
25290b7aa0
commit
5b8314245c
@ -36,7 +36,8 @@ export const getRollupConfig = (config: SLSOptions) => {
|
||||
|
||||
const providedDeps = [
|
||||
'@nuxt/devalue',
|
||||
'vue-bundle-renderer'
|
||||
'vue-bundle-renderer',
|
||||
'@cloudflare/kv-asset-handler'
|
||||
]
|
||||
|
||||
const extensions = ['.ts', '.mjs', '.js', '.json', '.node']
|
||||
|
@ -1,7 +1,25 @@
|
||||
import { extendTarget } from '../utils'
|
||||
import { SLSTarget } from '../config'
|
||||
import { resolve } from 'path'
|
||||
import { writeFile } from 'fs-extra'
|
||||
import consola from 'consola'
|
||||
import { extendTarget, prettyPath } from '../utils'
|
||||
import { SLSOptions, SLSTarget } from '../config'
|
||||
import { worker } from './worker'
|
||||
|
||||
export const cloudflare: SLSTarget = extendTarget(worker, {
|
||||
|
||||
entry: '{{ runtimeDir }}/cloudflare',
|
||||
generateIgnore: [
|
||||
'wrangler.toml'
|
||||
],
|
||||
hooks: {
|
||||
async done ({ targetDir }: SLSOptions) {
|
||||
const pkgPath = resolve(targetDir, 'package.json')
|
||||
const pkg = {
|
||||
private: true,
|
||||
main: './_nuxt.js'
|
||||
}
|
||||
await writeFile(pkgPath, JSON.stringify(pkg, null, 2))
|
||||
consola.info('Generated', prettyPath(pkgPath))
|
||||
consola.success('Ready to run `wrangler publish`')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user