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
* improve bundling code, use output stream `open` event ([b19ec43](https://github.com/digitalmaas/serverless-plugin-browserifier/commit/b19ec43651425e68219678e4a598cc5d2b1b1da9))
8
+
9
+
10
+
### Features
11
+
12
+
* add SLS_BROWSERIFIER_DEBUG flag ([1dac77e](https://github.com/digitalmaas/serverless-plugin-browserifier/commit/1dac77e52dbd7defd6b9bce20e79791ef5eb1f58))
The `package.individually` setting must be set -- either on global or function level -- to allow minimal bundle size based on each lambda's entrypoint.
54
66
67
+
You're all set! Use your normal serverless commands to package and deploy.
55
68
56
-
Configuration
57
-
-------------
58
69
59
-
For most use cases you should **NOT** need to do any configuration. You can, however, introduce custom configuration.
70
+
Advanced Configuration
71
+
----------------------
72
+
73
+
For most use cases you should **NOT** need to do any extra configuration. That said, the ability is present if you need it.
60
74
61
75
The base config for browserify is read from the `custom.browserify` section of `serverless.yml`. All [browserify options][browserify-options] are supported (most are auto configured by this plugin). This plugin adds one special option `disable` which if `true` will bypass this plugin.
62
76
@@ -99,22 +113,21 @@ functions:
99
113
```
100
114
101
115
102
-
Usage
103
-
-----
116
+
### Debugging
104
117
105
118
When this plugin is enabled, and `package.individually` is `true`, running `serverless deploy` and `serverless deploy -f <funcName>` will automatically browserify your Node.js lambda code.
106
119
107
-
If you want to see more information about the process, simply set `SLS_DEBUG=*`. Example:
120
+
If you want to see more information about the process, simply set envvar `SLS_DEBUG=*` for full serverless debug output, or `SLS_BROWSERIFIER_DEBUG=*` for plugin only debug messages. Example:
121
+
108
122
```
109
123
$ export SLS_DEBUG=*
110
124
$ sls deploy function -v -f usersGet
111
125
```
112
126
113
-
You can also verify your bundles by simply using `sls package`, which bundles everything up but does not deploy.
127
+
You may also verify your bundles by simply using `sls package`, which bundles everything up but does not deploy.
114
128
115
129
116
-
Using browserify plugins/transforms
117
-
-----------------------------------
130
+
### Using browserify plugins/transforms
118
131
119
132
If you want to use browserify plugins, you can easily do that by using the global browserify options. As the plugin merely passes that up to browserify, as if it is calling the main [`browserify`][browserify-options] function, you can use it to add any transformations you want.
120
133
@@ -146,10 +159,9 @@ custom:
146
159
For an in-depth example, please check [this issue](https://github.com/digitalmaas/serverless-plugin-browserifier/issues/8).
147
160
148
161
149
-
Best practices
150
-
--------------
162
+
### Best practices
151
163
152
-
__If using it with AWS, use discrete SDK clients!__
164
+
#### If using it with AWS, use discrete SDK clients!
153
165
154
166
The official [aws-sdk-js][aws-sdk] officially [supports browserify][aws-sdk-support]. That allows us to further reduce the size of our bundles (and Lambda memory usage and speed) by loading only what is strictly needed.
Although you can use discrete clients (see item above), AWS Lambda service always bundles up the latest SDK version in its Lambda container image. That means that, even if you don't add AWS SDK to your bundle, it will still be available in runtime.
168
180
@@ -176,6 +188,36 @@ custom:
176
188
- aws-sdk/clients/s3
177
189
```
178
190
191
+
To help you out, here's a script you can use to hide `aws-sdk` and all its clients from browserify. You can use it in your custom config for the plugin in _serverless.yml_:
0 commit comments