Comments (7)
Hi @jojo05
That is up to the user to configure in their build tool.
If you use webpack for instance, you can configure to make 2 bundles
- vendor: ['preact', 'lodash', 'moment', 'etc..']
- widget: contains your core widget code, however, you want to ensure vendor bundle availability
it is well documented here: https://webpack.github.io/docs/code-splitting.html
I'll leave this ticket open for any further questions
from preact-habitat.
Closing this for now, please re-open if any help is needed.
from preact-habitat.
Thanks. I am trying to figure out how to do this in preact-cli, using an html template
Does preact-cli fall short for your needs?
from preact-habitat.
Hi @jojo05 apologize for my delayed response.
Making your component portable requires 2 things:
- UMD as a target library type.
- Having power to modify the output HTML or choose your own HTML template to start with.
I will go speak with the CLI folks as I'm user but not expert in Preact-cli and I'll let you know if that's possible. Maybe make an example as well.
from preact-habitat.
Thanks.
Maybe you should open an issue so that the discussion is open to anyone.
from preact-habitat.
Hi @zouhir.
Not sure about UMD. I am looking for the simplest thing that will work, e.g. I like the approach taken by the accessible-autocomplete library
https://github.com/alphagov/accessible-autocomplete/blob/master/examples/preact/index.html#L334:L344
The second point is clear, so preact should always be used with a template.
from preact-habitat.
Hi @jojo05
I just thought I drop you a reference if you would like to use preact-habitat with preact-cli:
https://github.com/zouhir/widget-template
I hop that helps.
The approach used by that example should work fine for your widget, you can totally use it if you like!
from preact-habitat.
Related Issues (20)
- Ability to replace the container rather than mount inside HOT 1
- Update doc example HOT 1
- Widget double rendering HOT 2
- Feat: Should rerender component when called `render` again? HOT 3
- Generate file per component HOT 5
- Asynchronously added widget not showing up HOT 2
- Compatibility with Unistore HOT 2
- Broken example: ReferenceError: Welcome is not defined
- [Question] Why do you use `text/props` as MIME type for the config element? HOT 1
- Can I render widget into iframe? HOT 2
- Compatablity with Preact X HOT 5
- Compatibility of adding Preact-portal in preact-habitat HOT 2
- Add maintainers to this project HOT 4
- Props removed with clean and inline options set to true
- Define props on script tag for "inline" render? HOT 1
- [Question] - Sharing logic between widgets HOT 2
- Handling clicks and interactions - widget showing based on click HOT 5
- Support Hydration
- Cannot read properties of undefined (reading 'render') HOT 1
- dynamically imported module
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-habitat.