atomicojs / atomico

Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
https://atomicojs.dev
MIT License
1.16k stars 43 forks source link

UNPKG error: `Cannot find "/index.js" in atomico@1.30.2` #54

Closed Explosion-Scratch closed 3 years ago

Explosion-Scratch commented 3 years ago

index.js does not exist. Perhaps this is built somehow? Anyways, is there an alternate way to use atomico in the browser?

UpperCod commented 3 years ago

Hi Atomico works on any CDN that supports ESM, example:

  1. unpkg.com/atomico/core : now in unpkg you should add the prefix core, I will correct this in the next version.(it is already corrected in atomico@1.30.3)
  2. esm.sh/atomico
  3. cdn.skypack.dev/atomico

to use Atomico in the browser you only need the import, example:

import { c, html, css } from "https://cdn.skypack.dev/atomico";

function component(){
  return html`<host shadowDom>
    <h1>Atomic in browser</h1>    
  </host>`;
}

component.styles = css`
  :host{
    font-family: monospace;
    color: crimson;
  }
`

customElements.define("my-component",c(component));

livecode

by the way you can start with Atomico using the command npm init @atomico or cloning this repo https://github.com/atomicojs/base, I invite you to join Discord

Explosion-Scratch commented 3 years ago

Thanks! Super excited to use this!