Skip to content

Commit 6408a6f

Browse files
committed
try to simplify cf config
1 parent b8f359c commit 6408a6f

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

src/module.ts

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,17 @@ export default defineNuxtModule<ModuleOptions>({
9090

9191
if (nuxt.options.nitro.preset?.includes('cloudflare') || hub.hosting.includes('cloudflare')) {
9292
// Fix cloudflare:* externals in rollup
93-
nuxt.options.nitro.rollupConfig = nuxt.options.nitro.rollupConfig || {}
94-
nuxt.options.nitro.rollupConfig.plugins = ([] as any[]).concat(nuxt.options.nitro.rollupConfig.plugins || [])
95-
nuxt.options.nitro.rollupConfig.plugins.push({
96-
name: 'nuxthub-rollup-plugin',
97-
resolveId(id: string) {
98-
if (id.startsWith('cloudflare:')) {
99-
return { id, external: true }
100-
}
101-
return null
102-
}
103-
})
93+
// nuxt.options.nitro.rollupConfig = nuxt.options.nitro.rollupConfig || {}
94+
// nuxt.options.nitro.rollupConfig.plugins = ([] as any[]).concat(nuxt.options.nitro.rollupConfig.plugins || [])
95+
// nuxt.options.nitro.rollupConfig.plugins.push({
96+
// name: 'nuxthub-rollup-plugin',
97+
// resolveId(id: string) {
98+
// if (id.startsWith('cloudflare:')) {
99+
// return { id, external: true }
100+
// }
101+
// return null
102+
// }
103+
// })
104104

105105
// Enable Cloudflare Node.js compatibility
106106
nuxt.options.nitro.cloudflare ||= {}
@@ -111,38 +111,38 @@ export default defineNuxtModule<ModuleOptions>({
111111
nuxt.options.nitro.prerender.autoSubfolderIndex ||= false
112112

113113
// Enable Async Local Storage
114-
nuxt.options.nitro.unenv = nuxt.options.nitro.unenv || {}
115-
116-
// @ts-expect-error unenv is not typed here
117-
nuxt.options.nitro.unenv.external = nuxt.options.nitro.unenv.external || []
118-
// @ts-expect-error unenv is not typed here
119-
if (!nuxt.options.nitro.unenv.external.includes('node:async_hooks')) {
120-
// @ts-expect-error unenv is not typed here
121-
nuxt.options.nitro.unenv.external.push('node:async_hooks')
122-
}
123-
124-
// Production mode
125-
if (!nuxt.options.dev) {
126-
// Add node:stream to unenv external (only for Cloudflare Pages/Workers)
127-
// @ts-expect-error unenv is not typed here
128-
if (!nuxt.options.nitro.unenv.external.includes('node:stream')) {
129-
// @ts-expect-error unenv is not typed here
130-
nuxt.options.nitro.unenv.external.push('node:stream')
131-
}
132-
// @ts-expect-error unenv is not typed here
133-
if (!nuxt.options.nitro.unenv.external.includes('node:process')) {
134-
// @ts-expect-error unenv is not typed here
135-
nuxt.options.nitro.unenv.external.push('node:process')
136-
}
137-
// Add safer-buffer as alias to node:buffer
138-
// @ts-expect-error unenv is not typed here
139-
nuxt.options.nitro.unenv.alias ||= {}
140-
// @ts-expect-error unenv is not typed here
141-
if (!nuxt.options.nitro.unenv.alias['safer-buffer']) {
142-
// @ts-expect-error unenv is not typed here
143-
nuxt.options.nitro.unenv.alias['safer-buffer'] = 'node:buffer'
144-
}
145-
}
114+
// nuxt.options.nitro.unenv = nuxt.options.nitro.unenv || {}
115+
116+
// // @ts-expect-error unenv is not typed here
117+
// nuxt.options.nitro.unenv.external = nuxt.options.nitro.unenv.external || []
118+
// // @ts-expect-error unenv is not typed here
119+
// if (!nuxt.options.nitro.unenv.external.includes('node:async_hooks')) {
120+
// // @ts-expect-error unenv is not typed here
121+
// nuxt.options.nitro.unenv.external.push('node:async_hooks')
122+
// }
123+
124+
// // Production mode
125+
// if (!nuxt.options.dev) {
126+
// // Add node:stream to unenv external (only for Cloudflare Pages/Workers)
127+
// // @ts-expect-error unenv is not typed here
128+
// if (!nuxt.options.nitro.unenv.external.includes('node:stream')) {
129+
// // @ts-expect-error unenv is not typed here
130+
// nuxt.options.nitro.unenv.external.push('node:stream')
131+
// }
132+
// // @ts-expect-error unenv is not typed here
133+
// if (!nuxt.options.nitro.unenv.external.includes('node:process')) {
134+
// // @ts-expect-error unenv is not typed here
135+
// nuxt.options.nitro.unenv.external.push('node:process')
136+
// }
137+
// // Add safer-buffer as alias to node:buffer
138+
// // @ts-expect-error unenv is not typed here
139+
// nuxt.options.nitro.unenv.alias ||= {}
140+
// // @ts-expect-error unenv is not typed here
141+
// if (!nuxt.options.nitro.unenv.alias['safer-buffer']) {
142+
// // @ts-expect-error unenv is not typed here
143+
// nuxt.options.nitro.unenv.alias['safer-buffer'] = 'node:buffer'
144+
// }
145+
// }
146146
}
147147

148148
// Add .data to .gitignore

0 commit comments

Comments
 (0)