Vite example#598
Conversation
|
Current status:
Currently the build results in the following error: Also, a warning is emitted This page has some interesting information http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility, ultimately recommending that client-side libraries expose entry points that don't rely on Node polyfills. |
|
I'm not sure what the best solution for this would be, but ideally ShareDB would provide a build for the client entrypoint that is compatible with Vite and other build systems that do not have built-in support for Node polyfills. ProposalIntroduce a new asset published to NPM that is a pre-built bundle of the client-side only. For consumers of ShareDB, instead of saying we could say To produce Thoughts? |
|
CI breakage is unrelated to this change. See also: |
|
This is working and ready for review. |
ericyhwang
left a comment
There was a problem hiding this comment.
I haven't used Vite before, but seems straightforward enough! Just one suggestion around the ESLint config.
Re-review should happen without much delay, I was on vacation then got sick, so I'm just now getting caught up.
| // Support ES6 imports and exports | ||
| ecmaVersion: 6, | ||
| sourceType: 'module' |
There was a problem hiding this comment.
Since this repo in general uses ES3 syntax at the moment, I'd recommend doing a glob override to use this custom config just for the new example, instead of for the entire repo:
https://eslint.org/docs/latest/use/configure/configuration-files#configuration-based-on-glob-patterns
|
Thanks for the review @ericyhwang ! Feedback addressed. |
ericyhwang
left a comment
There was a problem hiding this comment.
LGTM, thanks for the new example!
|
Amazing! Thanks a ton. |

Towards #593 by cloning the
counter-json1example and attempting to adapt it to use Vite.Desired workflows:
npm startto start the server, then in another terminal/tabnpm run devto load the front end with hot reloading enabled (still need to set up the WebSocket proxy for this, but there are blockers in the way of getting to this point)npm run buildfollowed bynpm start, like in the other examples.