File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 8
8
} from '@nuxt/kit'
9
9
import { name , version } from '../package.json'
10
10
11
+ const DEFAULT_HOSTNAMES = [ 'localhost' ]
12
+
11
13
export interface ModuleOptions {
12
14
/**
13
15
* Whether the tracker shall be enabled.
@@ -103,7 +105,7 @@ export default defineNuxtModule<ModuleOptions>({
103
105
enabled : true ,
104
106
hashMode : false ,
105
107
domain : '' ,
106
- ignoredHostnames : [ 'localhost' ] ,
108
+ ignoredHostnames : [ ] ,
107
109
ignoreSubDomains : false ,
108
110
trackLocalhost : false ,
109
111
apiHost : 'https://plausible.io' ,
@@ -118,11 +120,14 @@ export default defineNuxtModule<ModuleOptions>({
118
120
// Dedupe `ignoredHostnames` items
119
121
options . ignoredHostnames = Array . from ( new Set ( options . ignoredHostnames ) )
120
122
123
+ // Add default hostnames if `ignoredHostnames` is empty
124
+ if ( options . ignoredHostnames . length === 0 ) {
125
+ options . ignoredHostnames = DEFAULT_HOSTNAMES
126
+ }
127
+
121
128
// Migrate `trackLocalhost` to `ignoredHostnames`
122
129
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.' )
126
131
options . ignoredHostnames = options . ignoredHostnames . filter (
127
132
domain => domain !== 'localhost' ,
128
133
)
You can’t perform that action at this time.
0 commit comments