Skip to content

preact as global singleton for no-build components? #3966

Answered by rschristian
eballeste asked this question in Q&A
Discussion options

You must be logged in to vote

Is this all you're looking for?

https://jsfiddle.net/t9xy01kh/1/

It'll just load and execute as soon as the page loads.

Import maps may be of interest. Define once, everything else will just consume from it.

https://jsfiddle.net/aeghk5p8/

Is this some sort of anti-pattern/bad practice type of deal and that's why I can't seem to find a solution or is there something else happening where this must be setup as modules if we want to take the no-build approach?

It's not really clear to me why you think ESM will not work for your situation, or why you're trying to control module loading the way you are, but yes, ESM is the way the ecosystem is going and it's going to generally be nicer to l…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@eballeste
Comment options

@rschristian
Comment options

Answer selected by eballeste
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants