Skip to content

Commit

Permalink
Merge pull request serverless-heaven#450 from stevemao/patch-1
Browse files Browse the repository at this point in the history
commonjs2 is the one that nodejs is using
  • Loading branch information
HyperBrain authored Apr 7, 2019
2 parents 557170b + eec2cb8 commit 9f4500e
Show file tree
Hide file tree
Showing 9 changed files with 1,134 additions and 1,134 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const path = require('path');
module.exports = {
// ...
output: {
libraryTarget: 'commonjs',
libraryTarget: 'commonjs2',
path: path.resolve(__dirname, '.webpack'),
filename: '[name].js',
},
Expand Down Expand Up @@ -302,17 +302,17 @@ custom:
#### Runtime dependencies
If a runtime dependency is detected that is found in the `devDependencies` section and
so would not be packaged, the plugin will error until you explicitly exclude it (see `forceExclude` below)
so would not be packaged, the plugin will error until you explicitly exclude it (see `forceExclude` below)
or move it to the `dependencies` section.
#### AWS-SDK
An exception for the runtime dependency error is the AWS-SDK. All projects using the AWS-SDK normally
have it listed in `devDependencies` because AWS provides it already in their Lambda environment. In this case
have it listed in `devDependencies` because AWS provides it already in their Lambda environment. In this case
the aws-sdk is automatically excluded and only an informational message is printed (in `--verbose` mode).
The main reason for the warning is, that silently ignoring anything contradicts the declarative nature
of Serverless' service definition. So the correct way to define the handling for the aws-sdk is, as
of Serverless' service definition. So the correct way to define the handling for the aws-sdk is, as
you would do for all other excluded modules (see `forceExclude` below).
```yaml
Expand All @@ -339,7 +339,7 @@ custom:
```
You should select the packager, that you use to develop your projects, because only
then locked versions will be handled correctly, i.e. the plugin uses the generated
then locked versions will be handled correctly, i.e. the plugin uses the generated
(and usually committed) package lock file that is created by your favorite packager.
Each packager might support specific options that can be set in the `packagerOptions`
Expand Down Expand Up @@ -372,7 +372,7 @@ You can specify custom scripts that are executed after the installation of the f
has been finished. These are standard packager scripts as they can be used in any `package.json`.
Warning: The use cases for them are very rare and specific and you should investigate first,
if your use case can be covered with webpack plugins first. They should never access files
if your use case can be covered with webpack plugins first. They should never access files
outside of their current working directory which is the compiled function folder, if any.
A valid use case would be to start anything available as binary from `node_modules`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
]
},
output: {
libraryTarget: 'commonjs',
libraryTarget: 'commonjs2',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
}
Expand Down
2 changes: 1 addition & 1 deletion examples/babel/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
]
},
output: {
libraryTarget: 'commonjs',
libraryTarget: 'commonjs2',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
}
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-statically-entries/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
},
target: 'node',
output: {
libraryTarget: 'commonjs',
libraryTarget: 'commonjs2',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
},
Expand Down
2 changes: 1 addition & 1 deletion examples/serverless-offline/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
target: 'node',
externals: [nodeExternals()],
output: {
libraryTarget: 'commonjs',
libraryTarget: 'commonjs2',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
},
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
]
},
output: {
libraryTarget: 'commonjs',
libraryTarget: 'commonjs2',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
},
Expand Down
2 changes: 1 addition & 1 deletion lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ module.exports = {
if (!this.webpackConfig.output || _.isEmpty(this.webpackConfig.output)) {
const outputPath = path.join(this.serverless.config.servicePath, '.webpack');
this.webpackConfig.output = {
libraryTarget: 'commonjs',
libraryTarget: 'commonjs2',
path: outputPath,
filename: '[name].js',
};
Expand Down
Loading

0 comments on commit 9f4500e

Please sign in to comment.