chore: initial commit
This commit is contained in:
21
src/module.ts
Normal file
21
src/module.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { defineNuxtModule, addPlugin, createResolver } from '@nuxt/kit'
|
||||
|
||||
// Module options TypeScript interface definition
|
||||
export interface ModuleOptions {
|
||||
0: string
|
||||
}
|
||||
|
||||
export default defineNuxtModule<ModuleOptions>({
|
||||
meta: {
|
||||
name: 'my-module',
|
||||
configKey: 'myModule',
|
||||
},
|
||||
// Default configuration options of the Nuxt module
|
||||
defaults: {},
|
||||
setup(_options, _nuxt) {
|
||||
const resolver = createResolver(import.meta.url)
|
||||
|
||||
// Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack`
|
||||
addPlugin(resolver.resolve('./runtime/plugin'))
|
||||
},
|
||||
})
|
||||
5
src/runtime/plugin.ts
Normal file
5
src/runtime/plugin.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { defineNuxtPlugin } from '#app'
|
||||
|
||||
export default defineNuxtPlugin((_nuxtApp) => {
|
||||
console.log('Plugin injected by my-module!')
|
||||
})
|
||||
3
src/runtime/server/tsconfig.json
Normal file
3
src/runtime/server/tsconfig.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../../../.nuxt/tsconfig.server.json",
|
||||
}
|
||||
Reference in New Issue
Block a user