Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto committed Nov 3, 2024
1 parent 302c751 commit d57915d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 52 deletions.
2 changes: 1 addition & 1 deletion docs/en/docs/commands/dev.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ Below is a breakdown of the available flags for the `dev` command:

- Once development is complete, it's time to [build your extension](/docs/commands/build).
- Learn how to create features specific to a browser with the [browser-specific manifest fields](/docs/features/browser-fields).
- Use the `extension.config.js` file to [configure your extension](/docs/configuration).
- Use the `extension.config.js` file to [configure your extension](/docs/features/config).
2 changes: 1 addition & 1 deletion docs/en/docs/commands/preview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ In this example, the extension is created in the `path/to/my-extension` director
## Next Steps

- Learn how to [build](/docs/commands/build) your extension.
- Use the `extension.config.js` file to [configure your extension](/docs/configuration).
- Use the `extension.config.js` file to [configure your extension](/docs/features/config).
1 change: 0 additions & 1 deletion docs/en/docs/development/background.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,3 @@ dist/
## Next Steps

- Learn more about structuring and using [Special Folders](../features/special-folders.mdx).
- Discover the options for managing resources and event handling with [Extension.js Background API](../features/background-api).
2 changes: 1 addition & 1 deletion docs/en/docs/development/content_scripts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ dist/
## Next Steps

- For further details on using special folders, refer to the [Special Folders documentation](../features/special-folders.mdx).
- Learn about managing resources with [Web-Accessible Resources](../web-accessible-resources).
- Learn about managing resources with [Web-Accessible Resources](./web_accessible_resources).
2 changes: 1 addition & 1 deletion docs/en/docs/development/icons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@ dist/
## Next Steps

- For handling icons and other assets, learn more about [Special Folders](../features/special-folders.mdx).
- Review Extension.js’s [Documentation on Web-Accessible Resources](../web-accessible-resources) for additional guidance on managing accessible assets.
- Review Extension.js’s [Documentation on Web-Accessible Resources](../development/web_accessible_resources) for additional guidance on managing accessible assets.
77 changes: 30 additions & 47 deletions docs/en/docs/development/web_accessible_resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ import { AvatarImage } from "../../../../theme/components/avatar-image";

# Extension Config File (`extension.config.js`)

> **Warning**: This feature is a work in progress and may be incomplete or subject to change.
> If you see an error or something that could be improved, please make a pull-request.
> **Warning**: This feature is a work in progress and may be incomplete or subject to change.
> If you see an error or something that could be improved, please make a pull-request.
> The link that documents this feature can be found at the bottom of the page.
The `extension.config.js` file enables developers to adjust the behavior of Extension.js.
This configuration file provides flexibility by enabling browser-specific configurations,
The `extension.config.js` file enables developers to adjust the behavior of Extension.js.
This configuration file provides flexibility by enabling browser-specific configurations,
command customization, and support for the massive ecosystem of webpack loaders and plugins.

## How Does It Work?

Adding a `extension.config.js` file at the same level as your `manifest.json` file will
Adding a `extension.config.js` file at the same level as your `manifest.json` file will
extend the capabilities of Extension.js. The config file includes the following keys:

| Key | Description |
| ---------- | --------------------------------------------------------- |
| `browser` | Defines browser-specific configurations. |
| `commands` | Customizes command behavior (`dev`, `preview`, `build`). |
| `config` | Modifies the webpack configuration for added flexibility. |
| Key | Description |
|------------|-------------------------------------------------------------|
| `browser` | Defines browser-specific configurations. |
| `commands` | Customizes command behavior (`dev`, `preview`, `build`). |
| `config` | Modifies the webpack configuration for added flexibility. |

### Browser Configuration

The `browser` key allows setting up browser-specific preferences, profiles, binaries,
The `browser` key allows setting up browser-specific preferences, profiles, binaries,
and flags. Below is an example configuration for Chrome and Firefox:

```js
Expand All @@ -42,23 +42,22 @@ browser: {
}
```

| Property | Description | Example |
| -------------- | ------------------------------------------ | ---------------------------- |
| `profile` | Specifies the path to the browser profile. | `'path/to/profile'` |
| `preferences` | Customizes preferences such as dark mode. | `{ darkMode: true }` |
| `browserFlags` | Adds flags to the browser launch process. | `['--disable-web-security']` |
| `chromeBinary` | Sets a custom Chrome binary path. | `'path/to/custom/chrome'` |
| `geckoBinary` | Sets a custom Firefox binary path. | `'path/to/custom/firefox'` |
| Property | Description | Example |
|---------------|-------------------------------------------------|----------------------------------------|
| `profile` | Specifies the path to the browser profile. | `'path/to/profile'` |
| `preferences` | Customizes preferences such as dark mode. | `{ darkMode: true }` |
| `browserFlags`| Adds flags to the browser launch process. | `['--disable-web-security']` |
| `chromeBinary`| Sets a custom Chrome binary path. | `'path/to/custom/chrome'` |
| `geckoBinary` | Sets a custom Firefox binary path. | `'path/to/custom/firefox'` |

> **Additional Resources**:
>
> - For a list of available flags for Chrome, refer to the [Chrome Command Line Switches](https://peter.sh/experiments/chromium-command-line-switches/).
> - For Edge flags, visit the [Microsoft Edge Command Line Options](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-command-line-options).
> - For Firefox, check the [Firefox Developer Documentation](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options).
### Commands Configuration

Use the `commands` key to customize how Extension.js runs commands like `dev`, `preview`,
Use the `commands` key to customize how Extension.js runs commands like `dev`, `preview`,
and `build`. Here's an example:

```js
Expand All @@ -75,17 +74,17 @@ commands: {
}
```

| Property | Description | Example |
| ------------- | ------------------------------------------------------- | -------------------- |
| `browser` | Specifies the browser for dev or preview mode. | `'chrome'` |
| `polyfill` | Enables polyfills for legacy browser compatibility. | `true` |
| `zipFilename` | Sets the filename for the output zip file during build. | `'my-extension.zip'` |
| `zip` | Enables zipping the extension in build process. | `true` |
| `zipSource` | Includes the source code in the zip file. | `true` |
| Property | Description | Example |
|----------------|---------------------------------------------------------|-----------------------------|
| `browser` | Specifies the browser for dev or preview mode. | `'chrome'` |
| `polyfill` | Enables polyfills for legacy browser compatibility. | `true` |
| `zipFilename` | Sets the filename for the output zip file during build. | `'my-extension.zip'` |
| `zip` | Enables zipping the extension in build process. | `true` |
| `zipSource` | Includes the source code in the zip file. | `true` |

### Webpack Configuration

The `config` key allows you to modify the default webpack configuration. This gives you
The `config` key allows you to modify the default webpack configuration. This gives you
the power to add additional loaders or plugins:

```js
Expand Down Expand Up @@ -119,13 +118,6 @@ module.exports = {
geckoBinary: "path/to/custom/firefox",
},
},
};
```

### Commands Configuration Sample

```js
module.exports = {
commands: {
dev: {
browser: "chrome",
Expand All @@ -145,15 +137,6 @@ module.exports = {
silent: true,
},
},
};
```

### Webpack Configuration Sample

```js
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");

module.exports = {
config: (config) => {
config.plugins = [
...config.plugins,
Expand All @@ -170,11 +153,11 @@ The `extension.config.js` types [are defined here](https://github.com/extension-

## Best Practices

- **Use the `extension.config.js` file**: Leverage the `extension.config.js` file to
- **Use the `extension.config.js` file**: Leverage the `extension.config.js` file to
customize your extension's behavior.
- **Separate browser-specific configurations**: Keep browser-specific configurations
- **Separate browser-specific configurations**: Keep browser-specific configurations
in the `browser` key.
- **Customize commands**: Use the `commands` key to adjust the behavior of commands
- **Customize commands**: Use the `commands` key to adjust the behavior of commands
like `dev`, `preview`, and `build`.

## Next Steps
Expand Down

0 comments on commit d57915d

Please sign in to comment.