Skip to content

Commit

Permalink
fix(docs): updated the readme for multi compile configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
RishikeshDarandale committed Sep 5, 2019
1 parent ad0b029 commit 4c01c07
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,34 @@ module.exports = {
};
```

You can also pass the multi compile configuration as below in webpack configuration:

```js
// webpack.config.js
module.exports = [
{
entry: './handler1.js',
target: 'node',
module: {
loaders: [ ... ],
},
},
{
entry: './handler2.js',
target: 'node',
module: {
loaders: [ ... ],
},
},
];
```

**Note**: At this moment there are two constraints while using multi compile configuration and listed below.

- You can not set `package.individually` flag to true.
- `output.path` should be same for all compile configuration provided.

Alternatively the Webpack configuration can export an asynchronous object (e.g. a promise or async function) which will be awaited by the plugin and resolves to the final configuration object. This is useful if the confguration depends on asynchronous functions, for example, defining the AccountId of the current aws user inside AWS lambda@edge which does not support defining normal process environment variables.

A basic Webpack promise configuration might look like this:
Expand Down

0 comments on commit 4c01c07

Please sign in to comment.