Browse Source

Add basic webpack.config.js example in readme

master
Nicola Peduzzi 8 years ago
parent
commit
be5116cbec
  1. 16
      README.md
  2. 1
      examples/babel/webpack.config.js
  3. 1
      examples/multiple-entries/webpack.config.js
  4. 1
      examples/typescript/webpack.config.js

16
README.md

@ -18,6 +18,8 @@ plugins:
- serverless-webpack
```
## Configure
By default the plugin will look for a `webpack.config.js` in the service directory.
In alternative you can specify a different file or configuration in the `serverless.yml` with:
@ -27,8 +29,20 @@ custom:
```
Note that, if the `output` configuration is not set, it will automatically be
generated to write bundles in the `.webpack` directory.
generated to write bundles in the `.webpack` directory. An base Webpack
configuration might look like this:
```javascript
// webpack.config.js
module.exports = {
entry: './handler.js',
target: 'node',
module: {
loaders: [ ... ]
}
};
```
By default, the plugin will try to bundle all dependencies. However, you don't
want to include all modules in some cases such as selectively import, excluding

1
examples/babel/webpack.config.js

@ -1,5 +1,6 @@
module.exports = {
entry: './handler.js',
target: 'node',
module: {
loaders: [{
test: /\.js$/,

1
examples/multiple-entries/webpack.config.js

@ -5,6 +5,7 @@ module.exports = {
first: './first.js',
second: './second.js'
},
target: 'node',
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '.webpack'),

1
examples/typescript/webpack.config.js

@ -7,6 +7,7 @@ module.exports = {
path: path.join(__dirname, '.webpack'),
filename: 'handler.js'
},
target: 'node',
module: {
loaders: [
{ test: /\.ts(x?)$/, loader: 'ts-loader' }

Loading…
Cancel
Save