Giter VIP home page Giter VIP logo

Comments (7)

zouhir avatar zouhir commented on May 19, 2024

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.

zouhir avatar zouhir commented on May 19, 2024

Closing this for now, please re-open if any help is needed.

from preact-habitat.

jojo05 avatar jojo05 commented on May 19, 2024

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.

zouhir avatar zouhir commented on May 19, 2024

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.

jojo05 avatar jojo05 commented on May 19, 2024

Thanks.

Maybe you should open an issue so that the discussion is open to anyone.

from preact-habitat.

jojo05 avatar jojo05 commented on May 19, 2024

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.

zouhir avatar zouhir commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.