File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 88} from '@nuxt/kit'
99import { name , version } from '../package.json'
1010
11+ const DEFAULT_HOSTNAMES = [ 'localhost' ]
12+
1113export interface ModuleOptions {
1214 /**
1315 * Whether the tracker shall be enabled.
@@ -103,7 +105,7 @@ export default defineNuxtModule<ModuleOptions>({
103105 enabled : true ,
104106 hashMode : false ,
105107 domain : '' ,
106- ignoredHostnames : [ 'localhost' ] ,
108+ ignoredHostnames : [ ] ,
107109 ignoreSubDomains : false ,
108110 trackLocalhost : false ,
109111 apiHost : 'https://plausible.io' ,
@@ -118,11 +120,14 @@ export default defineNuxtModule<ModuleOptions>({
118120 // Dedupe `ignoredHostnames` items
119121 options . ignoredHostnames = Array . from ( new Set ( options . ignoredHostnames ) )
120122
123+ // Add default hostnames if `ignoredHostnames` is empty
124+ if ( options . ignoredHostnames . length === 0 ) {
125+ options . ignoredHostnames = DEFAULT_HOSTNAMES
126+ }
127+
121128 // Migrate `trackLocalhost` to `ignoredHostnames`
122129 if ( options . trackLocalhost ) {
123- logger . warn (
124- 'The `trackLocalhost` option has been deprecated. Please use `ignoredHostnames` instead.' ,
125- )
130+ logger . warn ( 'The `trackLocalhost` option has been deprecated. Please use `ignoredHostnames` instead.' )
126131 options . ignoredHostnames = options . ignoredHostnames . filter (
127132 domain => domain !== 'localhost' ,
128133 )
You can’t perform that action at this time.
0 commit comments