Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrykWalach committed Jan 4, 2025
1 parent b629da2 commit c829eb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs-website/docs/how-isograph-works/babel-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ It is then used via adding the following to your `.babelrc.js`:
}
```

For HMR to work `@isograph/babel-plugin` must run before `react-refresh/babel`.

## Behavior

The babel plugin will replace calls to `iso` entrypoint with require calls to the appropriate `entrypoint.js` file.
Expand All @@ -28,7 +30,7 @@ export const foo = iso(`field Query.Foo { whatever }`)(({ data }) => {
doStuff();
});
// and this is transformed into
export const foo = ({ data }) => doStuff();
export const foo = iso(({ data }) => doStuff());
```

## Requirements
Expand Down
1 change: 1 addition & 0 deletions libs/isograph-babel-plugin/compileTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function compileTag(t, path, config) {
// This throws if the tag is invalid
compileImportStatement(t, path, type, field, 'entrypoint', config);
} else if (keyword === 'field') {
// replace `iso("field ...")` with `iso`
path.replaceWith(path.node.callee);
} else {
throw new Error(
Expand Down

0 comments on commit c829eb6

Please sign in to comment.