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
* Webpack 2 support has been dropped in favor of Webpack 4
32
+
* Cleaned up configuration. You should now use a `custom.webpack` object to configure everything relevant for the plugin. The old configuration still works but will be removed in the next major release. For details see below.
32
33
* This 5.0.0 prerelease is based on the current 4.4.0
33
34
34
35
For the complete release notes see the end of this document.
@@ -48,12 +49,27 @@ plugins:
48
49
49
50
## Configure
50
51
51
-
By default the plugin will look for a `webpack.config.js` in the service directory.
52
-
Alternatively, you can specify a different file or configuration in `serverless.yml`:
52
+
The configuration of the plugin is done by defining a `custom: webpack` object in your `serverless.yml` with your specific configuration. All settings are optional and will be set to reasonable defaults if missing.
53
+
54
+
See the sections below for detailed descriptions of the settings. The defaults are:
55
+
56
+
```yaml
57
+
custom:
58
+
webpack:
59
+
webpackConfig: 'webpack.config.js' # Name of webpack configuration file
60
+
webpackIncludeModules: false # Node modules configuration for packaging
61
+
packager: 'npm' # Reserved for future use. Any other values will not work right now.
62
+
packExternalModulesMaxBuffer: 200 * 1024 # Size of stdio buffers for spawned child processes
63
+
```
64
+
65
+
### Webpack configuration file
66
+
67
+
By default the plugin will look for a `webpack.config.js` in the service directory. Alternatively, you can specify a different file or configuration in `serverless.yml`.
53
68
54
69
```yaml
55
70
custom:
56
-
webpack: ./folder/my-webpack.config.js
71
+
webpack:
72
+
webpackConfig: ./folder/my-webpack.config.js
57
73
```
58
74
59
75
A base Webpack configuration might look like this:
@@ -209,7 +225,8 @@ module.exports = {
209
225
```yaml
210
226
# serverless.yml
211
227
custom:
212
-
webpackIncludeModules: true # enable auto-packing of external modules
228
+
webpack:
229
+
webpackIncludeModules: true # enable auto-packing of external modules
213
230
```
214
231
215
232
@@ -223,8 +240,9 @@ use a different package file, set `packagePath` to your custom `package.json`:
223
240
```yaml
224
241
# serverless.yml
225
242
custom:
226
-
webpackIncludeModules:
227
-
packagePath: '../package.json' # relative path to custom package.json file.
243
+
webpack:
244
+
webpackIncludeModules:
245
+
packagePath: '../package.json' # relative path to custom package.json file.
228
246
```
229
247
> Note that only relative path is supported at the moment.
230
248
@@ -246,10 +264,11 @@ your service's production dependencies in `package.json`.
246
264
```yaml
247
265
# serverless.yml
248
266
custom:
249
-
webpackIncludeModules:
250
-
forceInclude:
251
-
- module1
252
-
- module2
267
+
webpack:
268
+
webpackIncludeModules:
269
+
forceInclude:
270
+
- module1
271
+
- module2
253
272
```
254
273
255
274
#### Forced exclusion
@@ -262,10 +281,11 @@ Just add them to the `forceExclude` array property and they will not be packaged
262
281
```yaml
263
282
# serverless.yml
264
283
custom:
265
-
webpackIncludeModules:
266
-
forceExclude:
267
-
- module1
268
-
- module2
284
+
webpack:
285
+
webpackIncludeModules:
286
+
forceExclude:
287
+
- module1
288
+
- module2
269
289
```
270
290
271
291
If you specify a module in both arrays, `forceInclude` and `forceExclude`, the
0 commit comments