Replies: 1 comment 2 replies
-
React wrapper=> should be an optional dedicated guide we can link from the publishing guide (not everyone will need to support react) Exportsyes I would say exports should be like this For a single elementUsage: // only the classes
import { MyElement } from 'my-element';
// OR
// execute customElements.define
import 'my-element/define'; Import Map: "exports": {
".": "./src/index.js",
"define": "./src/my-element.js",
} For multiple elementUsage: // only the classes
import { MyElement, SubElement } from 'my-element';
// OR
// execute customElements.define for all elements
import 'my-element/define';
// execute customElements.define for a single element
import 'my-element/define-my-element';
import 'my-element/define-sub-element'; Import Map: "exports": {
".": "./src/index.js",
"define": "./src/define.js",
"define-my-element": "./src/my-element.js",
"define-sub-element": "./src/sub-element.js",
} For clarification the import 'my-element/define-my-element';
import 'my-element/define-sub-element'; |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@lit-labs/react
looks to be a nice way of wrapping web components created with any library as React components for compatibilityI was thinking that it might be a good add as an optional suggestion for the web components publishing guide
What do you think?
PS: Slightly related, this other section might also need an update to include export maps?
Beta Was this translation helpful? Give feedback.
All reactions