diff options
| author | Shinigami <[email protected]> | 2022-09-11 20:23:42 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-11 14:23:42 +0200 |
| commit | 8db9d6e8743d080431093b643b0a238d73c422e8 (patch) | |
| tree | da45e5432fbc232245922db569dc748af4c113f3 /docs/migration | |
| parent | 4efa530e5924e78712c220c9b4f4a0cf41cb5167 (diff) | |
| download | faker-8db9d6e8743d080431093b643b0a238d73c422e8.tar.xz faker-8db9d6e8743d080431093b643b0a238d73c422e8.zip | |
docs: upgrading guide (#1365)
Co-authored-by: Leyla Jähnig [email protected]
Co-authored-by: ST-DDT [email protected]
Diffstat (limited to 'docs/migration')
| -rw-r--r-- | docs/migration/index.md | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/docs/migration/index.md b/docs/migration/index.md deleted file mode 100644 index 6e4be2da..00000000 --- a/docs/migration/index.md +++ /dev/null @@ -1,53 +0,0 @@ -# Migration from faker.js v5 - -There are now two bundles: `cjs` and `esm` - -The browser bundle was dropped in favor of `esm` - -So if you like to use `Faker` in the **browser**, just use: - -```html -<script type="module"> - import { faker } from 'https://unpkg.com/@faker-js/faker'; - - console.log(`${faker.name.firstName()} ${faker.name.lastName()}`); -</script> -``` - -A stackblitz playground can be found here: https://stackblitz.com/edit/typescript-damv7h - -:::tip -Faker now provides TypeScript types out of the box. -So you can remove `@types/faker` completely. -::: - -You no longer need to import `faker` as a standard import, but as a tree shakeable instance. - -For JS: - -```js -const { faker } = require('@faker-js/faker'); - -// Or specific locale -const fakerDe = require('@faker-js/faker/locale/de'); -``` - -For TS: - -```ts -import { faker } from '@faker-js/faker'; - -// Or specific locale -import fakerDe from '@faker-js/faker/locale/de'; -``` - -:::tip -If you have many files using these imports, we suggest to use e.g. VSCode's search and replace functionality. -::: - ---- - -:::warning -You need to switch from the package `faker` to `@faker-js/faker`. -We also provided all historical versions under the new organization scope. So if you depend on a specific version you still can use `"@faker-js/faker": "5.5.3"`. -::: |
