diff --git a/README-VANILLA.md b/README-VANILLA.md index edcf6b24..424d5f71 100644 --- a/README-VANILLA.md +++ b/README-VANILLA.md @@ -30,7 +30,25 @@ Install using npm: npm install vanilla-jsoneditor ``` -Remark: for usage in a Svelte project, install `svelte-jsoneditor` instead. +Remark: for usage in a Svelte project, install and use `svelte-jsoneditor` instead of `vanilla-jsoneditor`. + +## Use + +If you have a setup for your project with a bundler (like Vite, Rollup, or Webpack), it is best to use the default ES import: + +```ts +// for use in a React, Vue, or Angular project +import { JSONEditor } from 'vanilla-jsoneditor' +``` + +If you want to use the library straight in the browser, use the provided standalone ES bundle: + +```ts +// for use directly in the browser +import { JSONEditor } from 'vanilla-jsoneditor/standalone.js' +``` + +The standalone bundle contains all dependencies of `vanilla-jsoneditor`, for example `lodash-es` and `Ajv`. If you use some of these dependencies in your project too, it means that they will be bundled twice in your web application, leading to a needlessly large application size. In general, it is preferable to use the default `import { JSONEditor } from 'vanilla-jsoneditor'` so dependencies can be reused. ## Use (Browser example loading the ES module): @@ -44,7 +62,7 @@ Remark: for usage in a Svelte project, install `svelte-jsoneditor` instead.