Skip to content

Commit

Permalink
Configure exports in package.json for the block library package
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Jul 22, 2022
1 parent 7e5227e commit ccfd4c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/block-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ _Parameters_

## Registering individual blocks

1. When you only care about registering the block when file gets imported:
1. When you only care about registering the block when file gets imported:

```js
import '@wordpress/block-library/verse/init';
```

2. When you want to use the reference to the block after it gets automatically registered:
2. When you want to use the reference to the block after it gets automatically registered:

```js
import verseBlock from '@wordpress/block-library/verse/init';
```

3. When you need a full control over when the block gets registered:
3. When you need a full control over when the block gets registered:

```js
import { init } from '@wordpress/block-library/verse';
Expand Down
11 changes: 10 additions & 1 deletion packages/block-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@
"node": ">=12"
},
"main": "build/index.js",
"module": "build-module/index.js",
"exports": {
".": {
"import": "./build-module/index.js",
"require": "./build/index.js"
},
"./babel-plugin": "./babel-plugin.js",
"./*": "./build-module/*/index.js",
"./*/init": "./build-module/*/init.js",
"./utils/*": null
},
"react-native": "src/index",
"sideEffects": [
"build-style/**",
Expand Down

0 comments on commit ccfd4c2

Please sign in to comment.