Skip to content

Commit dab4c07

Browse files
committed
Update README.md
1 parent 9f08f07 commit dab4c07

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,47 +73,44 @@ export default {
7373
By default, the plugin will mark all Node builtin modules and _all_ your `dev-`, `peer-` and `optionalDependencies` as external. Normal `dependencies` are left unmarked so Rollup will still bundle them with your code as expected in most situations.
7474

7575
#### packagePath?: string | string[] = []
76-
7776
If you're working with monorepos, the `packagePath` is made for you. It can take a path, or an array of paths, to your package.json file(s). If not specified, the default is to start with the current directory's package.json then go up scan for all package.json files in parent directories recursively until either the root git directory is reached or until no other package.json can be found.
7877

7978
#### builtins?: boolean = true
8079
#### deps?: boolean = false
8180
#### devDeps?: boolean = true
8281
#### peerDeps?: boolean = true
8382
#### optDeps?: boolean = true
84-
8583
Set the `builtins`, `deps`, `devDeps`, `peerDeps` and/or `optDeps` options to `false` to prevent the corresponding dependencies from being externalized, therefore letting Rollup bundle them with your code. Set them to `true` for Rollup to treat the corresponding dependencies as external.
8684

8785
#### include?: string | RegExp | (string | RegExp)[] = []
8886
#### exclude?: string | RegExp | (string | RegExp)[] = []
87+
Use the `include` option to force certain dependencies into the list of externals, for example:
88+
```js
89+
externals({
90+
deps: false, // Bundle dependencies in
91+
include: /^fsevents/ // Except for fsevents
92+
})
93+
```
8994

9095
Use the `exclude` option to remove certain dependencies from the list of externals, for example:
9196
```js
9297
externals({
9398
deps: true, // Don't bundle dependencies, we'll import/require them at runtime instead
9499
exclude: [
95100
'electron-reload', // Yet we want `electron-reload` bundled in
96-
/^vuex?/ // as well as the VueJS family (vue, vuex, vue-router, etc.)
101+
/^vue/ // as well as the VueJS family (vue, vuex, vue-router, etc.)
97102
]
98103
})
99104
```
100105

101-
Use the `include` option to force certain dependencies into the list of externals, for example:
102-
```js
103-
externals({
104-
optDeps: false, // Bundle optionalDependencies in
105-
include: /^fsevents/ // Except for fsevents
106-
})
107-
```
108-
109106
> Note 1 : falsy values in `include` and `exclude` are silently ignored. This allows for conditional constructs like so: `exclude: process.env.NODE_ENV === 'production' && /mydep/`.
110107
111108
> Note2 : this plugin uses an exact match against your imports, so if your are using some path substitution in your code, eg.:
112109
```js
113110
// in your code, say '@/' is mapped to some directory:
114111
import something from '@/mylib'
115112
```
116-
and you don't want `mylib` bundled in, then write:
113+
> and you don't want `mylib` bundled in, then write:
117114
```js
118115
// in rollup.config.js:
119116
externals({
@@ -139,7 +136,6 @@ export default {
139136

140137

141138
### Migrating from version 1.x
142-
143139
- In 1.x, normal dependencies were externalized by default. This is no more true, so you'll need to change:
144140
```js
145141
externals()
@@ -151,9 +147,8 @@ externals({ deps: true })
151147
if you want the same behavior.
152148

153149

154-
- For consistency with all other Rollup plugins out there, the `except` option from 1.x is now deprecated in favor of the Rollup-friendly `exclude` option. It will be removed in the next major release but is still accepted for backward compatibility and works exactly the same as `exclude` but it will issue a warning if used. To suppress this warning, just replace `except` with `exclude`.
150+
- For consistency with all other Rollup plugins out there, the `except` option from 1.x has been deprecated in 2.0 and removed in 3.0. Use the Rollup-friendly `exclude` option instead.
155151

156152

157153
## Licence
158-
159154
MIT

0 commit comments

Comments
 (0)