Scaffolding for Nuxt module

This commit is contained in:
Jarek Rozanski 2023-05-14 15:25:44 +00:00
commit 51db5e8b53
19 changed files with 16655 additions and 0 deletions

19
src/module.ts Normal file
View file

@ -0,0 +1,19 @@
import { defineNuxtModule, addPlugin, createResolver } from '@nuxt/kit'
// Module options TypeScript interface definition
export interface ModuleOptions {}
export default defineNuxtModule<ModuleOptions>({
meta: {
name: 'wideangle',
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
View file

@ -0,0 +1,5 @@
import { defineNuxtPlugin } from '#app'
export default defineNuxtPlugin((nuxtApp) => {
console.log('Plugin injected by wideangle!')
})