Comments (5)
Can you expound upon what you're after?
The standard preact template split each files in seperate modules and expects an
<div id="app"/>
to inject the preact app there.
But we want to build a web component wich can be included by a js module and its custom tag.
You can just remove the rendering of the Preact app, it's not necessary to keep around.
Here's a dead-simple demo: https://stackblitz.com/edit/vitejs-vite-uxbbae?file=src%2Fmain.jsx
from preact-custom-element.
perfect, I also found out you can use the index html as demo site for the custom element by removing the div id=app and use the custom element tag. Inside the build config for vite you can give the output js a static name, and this file can than be used as the custom element script by other sites.
Maybe we can add a small explanation on the readme.
from preact-custom-element.
I don't really think this is the place to document building libraries with Vite. If that's what you're after, Vite's docs are the best place to read about it.
from preact-custom-element.
yeah but they dont have a section specially for custom elements, and it's different than a normal libary.
from preact-custom-element.
It shouldn't be, no. It's the same as bundling any other side-effectual library (as opposed to providing package exports).
from preact-custom-element.
Related Issues (20)
- In Firefox, The Custom Element gets cloned when calling member function of props, like toUpperCase()
- Hydration with shadow root doesn't work HOT 2
- Hyphenated attributes and camelCased properties
- How do I use with unpkg? HOT 1
- Document behavior for multi-word attributes/props?
- I can't use hook HOT 3
- package does not work HOT 1
- Observed attributes break context providers
- Feature Request: Use the "render" function of preact/compat
- Preact Component's constructor is not called when custom element is created via document.createElement HOT 1
- It resets complex property to undefined when provided as second or later prop
- Expose methods HOT 2
- Interop problems with Svelte
- Add support for {mode: 'closed'}
- Pass the created HTML node to the preact component HOT 1
- Generating preact-ce.module.js HOT 1
- Extend element instead of creating new custom element
- Slots fail to pass as props when element is created after register() is called HOT 3
- Publish to npm 🙏 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from preact-custom-element.