Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to remove localhost from ignoredHostnames #30

Closed
obulat opened this issue Aug 2, 2024 · 5 comments
Closed

Impossible to remove localhost from ignoredHostnames #30

obulat opened this issue Aug 2, 2024 · 5 comments

Comments

@obulat
Copy link

obulat commented Aug 2, 2024

Description

The trackLocalhost option is deprecated, but the new way of setting this as ignoredHostnames: [] doesn't work.

"localhost" is always added to the ignoredHostnames array in the module setup.

When I added a log at the top of the setup, I see that options.ignoredHostnames array always contains "localhost". If you set the value of ignoredHostnames to something else, like ["none"], then this value is added to the default ["localhost"] array instead of replacing it.

@johannschopplich
Copy link
Collaborator

Good catch! Thanks a lot. I have just released v1.0.1 to fix this issue. You can now provide an empty ignoredHostnames array to allow localhost for tracking:

export default defineNuxtConfig({
  modules: ['@nuxtjs/plausible'],

  plausible: {
    ignoredHostnames: [],
  },
})

@obulat
Copy link
Author

obulat commented Aug 3, 2024

Thank you for the quick fix and release!

@obulat
Copy link
Author

obulat commented Aug 6, 2024

This did not fix the problem. I tried updating the module to v1.0.1 and replacing trackLocalhost with ignoredHostnames, and all of the analytics e2e tests failed, see this CI run. When I added trackLocalhost back, they passed.

After updating, the plugin types also broke: I had to manually add the types that were previously created by Nuxt automatically. This might be related to the "The inferred type of 'default' cannot be named without a reference to ..." warnings in the release action run for v1.0.1: https://github.com/nuxt-modules/plausible/actions/runs/10229250370
Would using a function for module defaults fix it?

johannschopplich added a commit that referenced this issue Aug 6, 2024

Verified

This commit was signed with the committer’s verified signature.
eadwu Edmund Wu
…host` (fixes #30)
@johannschopplich
Copy link
Collaborator

@obulat Thanks a lot for the follow-up. Indeed, the plugin types where broken as of recent changes to the Nuxt module builder. This should be fixed with v1.0.2.

Also, ignoredHostnames: [] should now work as intended... Please upgrade to the latest version and give me a hint if it worked out for ya. Thanks!

@obulat
Copy link
Author

obulat commented Aug 6, 2024

Thank you again for quick fix and release, @johannschopplich ! It's really fixed now, and we are about to migrate to the latest version :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants