Skip to content

Commit

Permalink
Add example intercept file content
Browse files Browse the repository at this point in the history
  • Loading branch information
jcalcaben committed Nov 16, 2020
1 parent 1ca3d69 commit 84ef809
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pwa-devdocs/src/pwa-buildpack/extensibility-framework/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ The TargetProvider object provides an `of()` function and an `own` property to a

For more information on how intercept files work, see the tutorial on how to [Intercept a Target][].

### Example intercept file content

```js
module.exports = targets => {

const builtins = targets.of("@magento/pwa-buildpack");
builtins.specialFeatures.tap((featuresByModule) => {
featuresByModule["my-extension"] = {
esModules: true,
};
});
};
}
```

The example provided defines an intercept file that intercepts the `specialFeatures` target in the `@magento/pwa-buildpack` package.
It adds a webpack configuration for the `my-extension` package that lets the build process know that the package uses ES modules.

### Intercept functions

When you call the `tap()` function on a Target, you supply it with an _intercept function_.
Expand Down

0 comments on commit 84ef809

Please sign in to comment.