Skip to content

Commit

Permalink
Merge pull request #195 from enhance-dev/externalize-bundles-plugin
Browse files Browse the repository at this point in the history
Updates docs to have users install the bundles plugin before using.
  • Loading branch information
kristoferjoseph authored Feb 21, 2024
2 parents 970be87 + 10eeb6f commit 75c5717
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
---
title: Browser Modules
title: Building for the browser
---

## The `@bundles` plugin

For most of your browser needs you can use Enhance's built-in [browser pattern](/docs/conventions/browser) but at times you may have a component that has special imports like `css-in-js` that requires the abilities of ESBuild. In these situations you can use [plugin-bundles](https://github.com/architect/plugin-bundles) to make your component available to the browser.

### Install

`npm i @architect/plugin-bundles`

Add the plugin and the components you want to bundle to your `.arc file`

```arc
@plugins
architect/plugin-bundles
@bundles
autocomplete '/utils/autocomplete.mjs'
```


### Basic Example

If you have written a bit of JS for your app that has an external dependency, you'll likely want to bundle your script with its dependency.
Expand Down
4 changes: 2 additions & 2 deletions app/docs/nav-data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const data = [
slug: 'patterns',
items: [
'progressive-enhancement',
'browser-modules',
'building-for-the-browser',
'form-validation',
{
slug: 'testing',
Expand Down Expand Up @@ -262,6 +262,6 @@ function parseItems(items, root, activePath) {
return parsedItems
}

export default function (docsRoute, activePath) {
export default function(docsRoute, activePath) {
return parseItems(data, docsRoute, activePath)
}

0 comments on commit 75c5717

Please sign in to comment.