1
1
import { fileURLToPath } from 'node:url'
2
2
import { resolve } from 'path'
3
3
import { addPlugin , defineNuxtModule } from '@nuxt/kit'
4
+ import { type NuxtModule } from '@nuxt/schema'
4
5
import { type FirebaseOptions } from '@firebase/app-types'
5
6
6
7
export interface VueFireNuxtModuleOptions {
@@ -20,27 +21,30 @@ export interface VueFireNuxtModuleOptions {
20
21
}
21
22
}
22
23
23
- export default defineNuxtModule < VueFireNuxtModuleOptions > ( {
24
- meta : {
25
- name : 'vuefire' ,
26
- configKey : 'vuefire' ,
27
- compatibility : {
28
- nuxt : '^3.0.0-0' ,
24
+ const VueFireModule : NuxtModule < VueFireNuxtModuleOptions > =
25
+ defineNuxtModule < VueFireNuxtModuleOptions > ( {
26
+ meta : {
27
+ name : 'vuefire' ,
28
+ configKey : 'vuefire' ,
29
+ compatibility : {
30
+ nuxt : '^3.0.0-0' ,
31
+ } ,
29
32
} ,
30
- } ,
31
33
32
- defaults : {
33
- optionsApiPlugin : false ,
34
- config : { } ,
35
- services : { } ,
36
- } ,
34
+ defaults : {
35
+ optionsApiPlugin : false ,
36
+ config : { } ,
37
+ services : { } ,
38
+ } ,
39
+
40
+ setup ( options , nuxt ) {
41
+ const runtimeDir = fileURLToPath ( new URL ( './runtime' , import . meta. url ) )
42
+ if ( options . optionsApiPlugin ) {
43
+ nuxt . options . build . transpile . push ( runtimeDir )
44
+ // TODO: check for individual options
45
+ addPlugin ( resolve ( runtimeDir , 'plugin' ) )
46
+ }
47
+ } ,
48
+ } )
37
49
38
- setup ( options , nuxt ) {
39
- const runtimeDir = fileURLToPath ( new URL ( './runtime' , import . meta. url ) )
40
- if ( options . optionsApiPlugin ) {
41
- nuxt . options . build . transpile . push ( runtimeDir )
42
- // TODO: check for individual options
43
- addPlugin ( resolve ( runtimeDir , 'plugin' ) )
44
- }
45
- } ,
46
- } )
50
+ export default VueFireModule
0 commit comments