You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-15Lines changed: 10 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,47 +73,44 @@ export default {
73
73
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.
74
74
75
75
#### packagePath?: string | string[] = []
76
-
77
76
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.
78
77
79
78
#### builtins?: boolean = true
80
79
#### deps?: boolean = false
81
80
#### devDeps?: boolean = true
82
81
#### peerDeps?: boolean = true
83
82
#### optDeps?: boolean = true
84
-
85
83
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.
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
+
```
89
94
90
95
Use the `exclude` option to remove certain dependencies from the list of externals, for example:
91
96
```js
92
97
externals({
93
98
deps:true, // Don't bundle dependencies, we'll import/require them at runtime instead
94
99
exclude: [
95
100
'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.)
97
102
]
98
103
})
99
104
```
100
105
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
-
109
106
> 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/`.
110
107
111
108
> Note2 : this plugin uses an exact match against your imports, so if your are using some path substitution in your code, eg.:
112
109
```js
113
110
// in your code, say '@/' is mapped to some directory:
114
111
importsomethingfrom'@/mylib'
115
112
```
116
-
and you don't want `mylib` bundled in, then write:
113
+
> and you don't want `mylib` bundled in, then write:
117
114
```js
118
115
// in rollup.config.js:
119
116
externals({
@@ -139,7 +136,6 @@ export default {
139
136
140
137
141
138
### Migrating from version 1.x
142
-
143
139
- In 1.x, normal dependencies were externalized by default. This is no more true, so you'll need to change:
144
140
```js
145
141
externals()
@@ -151,9 +147,8 @@ externals({ deps: true })
151
147
if you want the same behavior.
152
148
153
149
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.
0 commit comments