davidk
davidk
NNuxt
Created by davidk on 2/5/2025 in #❓・help
Disable Prefetch/Preload in dev mode on Nuxt Bridge
Hi there, does anyone know of a way to disable the prefetch/preload behavior during development while being on nuxt-bridge? I managed to disable it in production in the final build by adding a module with the following code:
import { defineNuxtModule } from '@nuxt/kit'
/**
* This module removes preloading / prefetching from the <head /> during build time to remove the size of the initial page load
* See https://github.com/nuxt/nuxt/issues/18376#issuecomment-1431318970
*/
export default defineNuxtModule({
meta: {
name: 'prefetch',
configKey: 'prefetch'
},
defaults: {
},
setup (options, nuxt) {
nuxt.hook('build:manifest', (manifest) => {
for (const key in manifest) {
manifest[key].dynamicImports = []
}
})
}
})
import { defineNuxtModule } from '@nuxt/kit'
/**
* This module removes preloading / prefetching from the <head /> during build time to remove the size of the initial page load
* See https://github.com/nuxt/nuxt/issues/18376#issuecomment-1431318970
*/
export default defineNuxtModule({
meta: {
name: 'prefetch',
configKey: 'prefetch'
},
defaults: {
},
setup (options, nuxt) {
nuxt.hook('build:manifest', (manifest) => {
for (const key in manifest) {
manifest[key].dynamicImports = []
}
})
}
})
But like I said this does not work when running yarn dev for example. I would really appreciate any help on this. Thanks. Oh, yet I am still using webpack unfortunately, not on vite but working on it.
5 replies