diff --git a/docs/2.guide/3.going-further/3.modules.md b/docs/2.guide/3.going-further/3.modules.md index 520cd2a1cc..4b95f7e829 100644 --- a/docs/2.guide/3.going-further/3.modules.md +++ b/docs/2.guide/3.going-further/3.modules.md @@ -579,6 +579,22 @@ export default defineNuxtModule({ }) ``` +For the server, you should use the `addServerTemplate` utility instead. + +```ts +import { defineNuxtModule, addServerTemplate } from '@nuxt/kit' + +export default defineNuxtModule({ + setup (options, nuxt) { + // The file is added to Nitro's virtual file system and can be imported in the server code from 'my-server-module.mjs' + addServerTemplate({ + filename: 'my-server-module.mjs', + getContents: () => 'export const myServerModule = () => "hello world !"' + }) + } +}) +``` + #### Adding Type Declarations You might also want to add a type declaration to the user's project (for example, to augment a Nuxt interface