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

Lit is in dev mode warning message shows up on localhost #4621

Open
mwawrusch opened this issue Apr 13, 2024 · 2 comments
Open

Lit is in dev mode warning message shows up on localhost #4621

mwawrusch opened this issue Apr 13, 2024 · 2 comments

Comments

@mwawrusch
Copy link

Which package(s) are affected?

Lit Core (lit / lit-html / lit-element / reactive-element)

Description

I am indirectly using lit through some other package and always get the 'Lit is running in dev mode' console warning, which is rather distracting.
It would be fantastic if you would NOT show this message when window.location.hostname is localhost.

Reproduction

See above.

Workaround

I have not found a workaround

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

all

Browser/OS/Node environment

all

@sorvell
Copy link
Member

sorvell commented Apr 13, 2024

Yeah, that can be annoying, but I'm not sure we can say it's always right to not show the warning on localhost.

Here's a workaround. Put this script before loading anything that contains Lit:

<script>
  const c = `Lit is in dev mode. Not recommended for production! See https://lit.dev/msg/dev-mode for more information.`
  window.litIssuedWarnings = new Set();
  litIssuedWarnings.add(c);
</script>

@justinfagnani
Copy link
Collaborator

If I were on a team I would want that snippet to issue it's own warning so it's not shipped to production.

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

No branches or pull requests

3 participants