Skip to content
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

How to load ESM from a CDN? (development without build) #394

Open
dimaqq opened this issue Jul 9, 2020 · 1 comment
Open

How to load ESM from a CDN? (development without build) #394

dimaqq opened this issue Jul 9, 2020 · 1 comment

Comments

@dimaqq
Copy link

dimaqq commented Jul 9, 2020

I'm playing around with a style of development where I'd write, for example:
import {html, Component, render, useState} from "https://unpkg.com/htm/preact/standalone.mjs";

And let evergreen browsers chew on that :)

It occurs to me that at the moment, same is not possible with aphrodite:

https://unpkg.com/aphrodite/dist/aphrodite.js is common js.

If I do import {css} from "https://unpkg.com/[email protected]/src/no-important.js";
then loading fails because src/util.js has import stringHash from 'string-hash';

It's same for es/..., where chunk-XXX has stringHash and import asap from 'asap';

@baryla
Copy link

baryla commented Aug 27, 2020

It may not solve your problem but I suggest you use a UMD build (https://unpkg.com/[email protected]/dist/aphrodite.umd.min.js) or use something like wzrd.in or bundle.run to bundle everything into an IIFE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants