https://github.com/rozek/liveblocks-bundle
a "liveblocks" bundle that can be used in no-build environments
https://github.com/rozek/liveblocks-bundle
Last synced: 6 months ago
JSON representation
a "liveblocks" bundle that can be used in no-build environments
- Host: GitHub
- URL: https://github.com/rozek/liveblocks-bundle
- Owner: rozek
- License: mit
- Created: 2024-04-29T12:22:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T12:42:46.000Z (over 2 years ago)
- Last Synced: 2025-07-18T00:35:49.454Z (about 1 year ago)
- Language: HTML
- Size: 120 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# liveblocks-bundle #
a "liveblocks" bundle that can be used directly in the browser (e.g., for no-build environments like REPLs or similar)
[liveblocks](https://github.com/liveblocks/liveblocks) has been designed to be used with a bundler like [Rollup](https://rollupjs.org/), [webpack](https://webpack.js.org/) or [Vite](https://vitejs.dev/).
If you want to use liveblocks in a "no-build environment" (such as a browser-based REPL), you may load the `liveblocks-bundle` from this repository using a simple `` element, wait for the `liveblocks` global to become available (because it has to be loaded as a JavaScript module) and then use it in your code:
```html
if (window.liveblocks == null) {
document.addEventListener('liveblocks',runApplication)
} else {
runApplication()
}
function runApplication () {
const {
createClient,
LiveList, LiveMap, LiveObject
} = window.liveblocks
// ....insert your liveblocks code here
}
```
`liveblocks-bundle` creates a global called `liveblocks` with the following contents:
* `createClient`
* 'LiveList', 'LiveMap' and 'LiveObject'
As a consequence, instead of
` import { createClient } from "@liveblocks/client"`
you now write
` const { createClient } = window.liveblocks`
or similar - as soon as `liveblocks` has become available.
## Build Instructions ##
You may easily build this package yourself.
Just install [NPM](https://docs.npmjs.com/) according to the instructions for your platform and follow these steps:
1. either clone this repository using [git](https://git-scm.com/) or [download a ZIP archive](https://github.com/rozek/liveblocks-bundle/archive/refs/heads/main.zip) with its contents to your disk and unpack it there
2. open a shell and navigate to the root directory of this repository
3. run `npm install` in order to install the complete build environment
4. execute `npm run build` to create a new build
## License ##
[MIT License](LICENSE.md)