-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not include major components in the bundle #13
Comments
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
it is well documented here: https://webpack.github.io/docs/code-splitting.html I'll leave this ticket open for any further questions |
Closing this for now, please re-open if any help is needed. |
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? |
Hi @jojo05 apologize for my delayed response. Making your component portable requires 2 things:
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. |
Thanks. Maybe you should open an issue so that the discussion is open to anyone. |
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. |
Hi @jojo05 I just thought I drop you a reference if you would like to use preact-habitat with preact-cli: The approach used by that example should work fine for your widget, you can totally use it if you like! |
There should be an option to omit certain components from the bundle i.e. preact.min.js should be declared as a script in the example so that is cached separately of the bundle.js. The same for large components that may be duplicated in different bundles
Does this make sense?
Thanks
The text was updated successfully, but these errors were encountered: