router-module
router-module copied to clipboard
Custom router in .nuxt folder
- If i add custom router in
.nuxtfolder, this fragment create relative link, but for.nuxtfolder it hasn't dot prefix, for example path to.nuxt/custom-router.jsiscustom-router.js, webpack try find package https://github.com/nuxt-community/router-module/blob/18bb2d39b55a9da8abec0a10a9f4552291dc0b39/src/module.ts#L50 Example:
['@nuxtjs/router', {
keepDefaultRouter: true,
path: path.resolve(__dirname, './.nuxt'),
fileName: 'cache-router.js',
}],
- I can't create
custom-router.jsbefore@nuxtjs/routercheck is file exist. Simplemodule.addTemplateworked only for second time (first time generate file) andwriteFileSynccreate file beforenuxtgenerate files, thereforenuxtdelete it. Only one worked variant is generate file withwriteFileSyncinsrcDirhttps://github.com/nuxt-community/router-module/blob/18bb2d39b55a9da8abec0a10a9f4552291dc0b39/src/module.ts#L40
Examples of module that overwrite router madhusudanbabar/k-domains and
https://github.com/Kolobok12309/vue-router-webcache/blob/f5411bc54e72efcd78f5ec8153b4a52965f80515/lib/nuxt/index.ts#L40-L46
@Kolobok12309 why are you trying to add your custom router on a dinamically created route?
@vis97c, to add some functionality from nuxt modules, for example my small package for enable vue-router working in webcache