starbeamjs / starbeam

Fun and simple reactivity
Other
343 stars 16 forks source link

using @starbeam/react Component breaks vite css module auto reload #118

Open patricklx opened 1 year ago

patricklx commented 1 year ago

in a react vite project if I have a

import styles from './App.module.css';

...
return Component(() => (<div className={styles.app}> </div>));

auto reload of css will not work anymore...

however, if I use useReactive it works

NullVoxPopuli commented 1 year ago

hello! does the latest unstable publish have the same issue?

patricklx commented 1 year ago

cannot install

 ERR_PNPM_WORKSPACE_PKG_NOT_FOUND  In : "@domtree/flavors@workspace:^" is in the dependencies but no package named "@domtree/flavors" is present in the workspace

This error happened while installing the dependencies of @starbeam/react@0.8.10-unstable.35f0b99
 at @starbeam/debug@0.8.10-unstable.35f0b99

edit: manually installed @domtree/flavors and then install worked

patricklx commented 1 year ago

now failing because of import.meta.url https://github.com/vitejs/vite/issues/14169 this is inside the vitests of @starbeam/debug... is there not way to strip out the test parts when published?

NullVoxPopuli commented 1 year ago

There will be. We currently don't have a production build were happy with, but that'll happen very soon.

What's published right now is development stuff.

NullVoxPopuli commented 1 year ago

what's your build environment like?

if you using esm.sh, like here: https://jsbin.com/kivuqal/1/edit?html,output it can compile away the import.meta stuff.

otherwise, you may need something like https://iendeavor.github.io/import-meta-env/guide/getting-started/introduction.html

patricklx commented 1 year ago

well, one step forward. Now i get that useSetup is not exported. And I see it does not exist anymore. Maybe I do not even need it?

NullVoxPopuli commented 1 year ago

yeah, there's been a streamlining of concepts since the docs were written -- here is a current example: https://github.com/starbeamjs/starbeam/blob/main/demos/react/src/components/formatter/DateFormatter-v1.tsx#L15