-
Notifications
You must be signed in to change notification settings - Fork 451
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
Vite example #598
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
.eslintrc.js
Outdated
// Support ES6 imports and exports | ||
ecmaVersion: 6, | ||
sourceType: 'module' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the new example!
Amazing! Thanks a ton. |
Towards #593 by cloning the
counter-json1
example and attempting to adapt it to use Vite.Desired workflows:
npm start
to start the server, then in another terminal/tabnpm run dev
to 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 build
followed bynpm start
, like in the other examples.