Skip to content

Commit 89e0868

Browse files
committed
Update docs
1 parent 36ccdcc commit 89e0868

File tree

1 file changed

+73
-6
lines changed

1 file changed

+73
-6
lines changed

README.md

Lines changed: 73 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ Plugin options can be set inside your `vue.config.js`:
8585
module.exports = {
8686
pluginOptions: {
8787
browserExtension: {
88-
options: {
89-
// options...
90-
}
88+
// options...
9189
}
9290
}
9391
}
@@ -99,15 +97,84 @@ module.exports = {
9997
The browser extension components that will be managed by this plugin.
10098

10199
Valid components are:
100+
- background
102101
- popup
103102
- options
104-
- contentScript
103+
- contentScripts
105104
- standalone
105+
- icons
106106

107107
```js
108108
components: {
109-
popup: true,
110-
contentScript: true
109+
background: true,
110+
contentScripts: true,
111+
icons: true
112+
}
113+
```
114+
115+
- **componentOptions**
116+
- Type: `Object.<string, Object>`
117+
118+
See [Component options](#component-options).
119+
120+
- **manifestSync**
121+
- Type: `Array<string>`
122+
- Default: `['version']`
123+
124+
Array containing names of `manifest.json` keys that will be automatically synced with `package.json` on build.
125+
126+
Currently, the only supported keys are `version` and `description`.
127+
128+
### Component options
129+
130+
Some browser extension components have additional options which can be set as follows:
131+
132+
```js
133+
// vue.config.js
134+
module.exports = {
135+
pluginOptions: {
136+
browserExtension: {
137+
componentOptions: {
138+
// <name of component>: <options>
139+
// e.g.
140+
contentScripts: {
141+
entries: {
142+
'content1': 'src/content-script1.js',
143+
'content2': 'src/content-script2.js'
144+
}
145+
}
146+
}
147+
}
148+
}
149+
}
150+
```
151+
152+
#### background
153+
154+
- **entry**
155+
- Type: `string|Array<string>`
156+
157+
Background script as webpack entry using the [single entry shorthand syntax](https://webpack.js.org/concepts/entry-points/#single-entry-shorthand-syntax).
158+
159+
```js
160+
background: {
161+
entry: 'src/my-background-script.js'
162+
}
163+
```
164+
165+
#### contentScripts
166+
167+
- **entries**
168+
- Type: `{[entryChunkName: string]: string|Array<string>}`
169+
170+
Content scripts as webpack entries using using the [object syntax](https://webpack.js.org/concepts/entry-points/#object-syntax).
171+
172+
```js
173+
contentScripts: {
174+
entries: {
175+
'my-first-content-script': 'src/content-script.js',
176+
'my-second-content-script': 'src/my-second-script.js'
177+
}
111178
}
112179
```
113180

0 commit comments

Comments
 (0)