File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ export default defineNuxtConfig({
55 } ,
66 } ,
77 modules : [ "../src/module" ] ,
8- utm : { } ,
8+ utm : {
9+ enabled : true ,
10+ } ,
911 devtools : { enabled : true } ,
1012} ) ;
Original file line number Diff line number Diff line change 11import { defineNuxtModule , addPlugin , createResolver } from "@nuxt/kit" ;
22
3- // Module options TypeScript interface definition
4- export interface ModuleOptions { }
3+ export interface ModuleOptions {
4+ enabled : boolean ;
5+ }
56
67export default defineNuxtModule < ModuleOptions > ( {
78 meta : {
89 name : "utm" ,
910 configKey : "utm" ,
1011 } ,
11- // Default configuration options of the Nuxt module
12- defaults : { } ,
13- setup ( ) {
12+ defaults : {
13+ enabled : true ,
14+ } ,
15+ setup ( options , nuxt ) {
1416 const resolver = createResolver ( import . meta. url ) ;
1517
16- // Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack`
17- addPlugin ( resolver . resolve ( "./runtime/plugin" ) ) ;
18+ if ( options . enabled ) {
19+ // Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack`
20+ addPlugin ( resolver . resolve ( "./runtime/plugin" ) ) ;
21+ }
1822 } ,
1923} ) ;
You can’t perform that action at this time.
0 commit comments