question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[lit] reexport of html from lit fails because of side effects?

See original GitHub issue

Description

I would expect to have a file with

export { html } from 'lit';

to also work if I execute it in node…

Steps to Reproduce

  1. Open Stackblitz demo https://stackblitz.com/edit/node-uqy5mf?file=index.js
  2. execute node index.js in the stackblitz terminal

Expected Results

A console log

Actual Results

❯ node index.js
Error: document is not defined
...

seems a side effect is doing something and fails

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
daKmoRcommented, Jul 27, 2022

sweet - for the simple test case

👉 index.js

console.log(`Hello from Node.js v${process.versions.node}!`);
export { html, css, LitElement, svg, unsafeCSS, nothing } from "lit";
console.log("✅ could export html via node");
node index.js

it works fine 💪

will check for Rocket tomorrow but I assume it will work fine 🤗

1reaction
daKmoRcommented, Aug 13, 2022

Updated and used in rocket now 🎉

Sooo nice to get rid of this “workaround” 💪 thxxx 🙇‍♂️

In case anyone is curious what it helped to clean up https://github.com/modernweb-dev/rocket/pull/398

Read more comments on GitHub >

github_iconTop Results From Across the Web

Re-export lit-html directives from LitElement #1069 - GitHub
Importing all the modules in one expression would eliminate the source of errors I encountered inadvertently loading multiple versions of lit-html.
Read more >
Tree Shaking - webpack
A "side effect" is defined as code that performs a special behavior when imported, other than exposing one or more exports. An example...
Read more >
Rendering - Lit.dev
Typically, the component's render() method returns a single TemplateResult object (the same type returned by the html tag function). However, it can return ......
Read more >
HMR API - Vite
This is the client HMR API. For handling HMR update in plugins, see handleHotUpdate. The manual HMR API is primarily intended for framework...
Read more >
Troubleshooting Omnibus GitLab installation issues
Ignoring errors can have unexpected side effects on the performance of your GitLab server, so it isn't recommended to do so. Another variation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found