Skip to content

Commit 41dd875

Browse files
author
Frank Schmid
committed
Revert "Merge pull request #450 from stevemao/patch-1"
This reverts commit 9f4500e, reversing changes made to 557170b. Fixes #505
1 parent f6fba80 commit 41dd875

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ const path = require('path');
230230
module.exports = {
231231
// ...
232232
output: {
233-
libraryTarget: 'commonjs2',
233+
libraryTarget: 'commonjs',
234234
path: path.resolve(__dirname, '.webpack'),
235235
filename: '[name].js',
236236
},
@@ -305,17 +305,17 @@ custom:
305305
#### Runtime dependencies
306306

307307
If a runtime dependency is detected that is found in the `devDependencies` section and
308-
so would not be packaged, the plugin will error until you explicitly exclude it (see `forceExclude` below)
308+
so would not be packaged, the plugin will error until you explicitly exclude it (see `forceExclude` below)
309309
or move it to the `dependencies` section.
310310

311311
#### AWS-SDK
312312

313313
An exception for the runtime dependency error is the AWS-SDK. All projects using the AWS-SDK normally
314-
have it listed in `devDependencies` because AWS provides it already in their Lambda environment. In this case
314+
have it listed in `devDependencies` because AWS provides it already in their Lambda environment. In this case
315315
the aws-sdk is automatically excluded and only an informational message is printed (in `--verbose` mode).
316316

317317
The main reason for the warning is, that silently ignoring anything contradicts the declarative nature
318-
of Serverless' service definition. So the correct way to define the handling for the aws-sdk is, as
318+
of Serverless' service definition. So the correct way to define the handling for the aws-sdk is, as
319319
you would do for all other excluded modules (see `forceExclude` below).
320320

321321
```yaml
@@ -342,7 +342,7 @@ custom:
342342
```
343343

344344
You should select the packager, that you use to develop your projects, because only
345-
then locked versions will be handled correctly, i.e. the plugin uses the generated
345+
then locked versions will be handled correctly, i.e. the plugin uses the generated
346346
(and usually committed) package lock file that is created by your favorite packager.
347347

348348
Each packager might support specific options that can be set in the `packagerOptions`
@@ -375,7 +375,7 @@ You can specify custom scripts that are executed after the installation of the f
375375
has been finished. These are standard packager scripts as they can be used in any `package.json`.
376376

377377
Warning: The use cases for them are very rare and specific and you should investigate first,
378-
if your use case can be covered with webpack plugins first. They should never access files
378+
if your use case can be covered with webpack plugins first. They should never access files
379379
outside of their current working directory which is the compiled function folder, if any.
380380
A valid use case would be to start anything available as binary from `node_modules`.
381381

examples/babel-multiple-statically-entries/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
]
2222
},
2323
output: {
24-
libraryTarget: 'commonjs2',
24+
libraryTarget: 'commonjs',
2525
path: path.join(__dirname, '.webpack'),
2626
filename: '[name].js'
2727
}

examples/babel/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
]
1919
},
2020
output: {
21-
libraryTarget: 'commonjs2',
21+
libraryTarget: 'commonjs',
2222
path: path.join(__dirname, '.webpack'),
2323
filename: '[name].js'
2424
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
},
1717
target: 'node',
1818
output: {
19-
libraryTarget: 'commonjs2',
19+
libraryTarget: 'commonjs',
2020
path: path.join(__dirname, '.webpack'),
2121
filename: '[name].js'
2222
},

examples/serverless-offline/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
target: 'node',
88
externals: [nodeExternals()],
99
output: {
10-
libraryTarget: 'commonjs2',
10+
libraryTarget: 'commonjs',
1111
path: path.join(__dirname, '.webpack'),
1212
filename: '[name].js'
1313
},

examples/typescript/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
]
1313
},
1414
output: {
15-
libraryTarget: 'commonjs2',
15+
libraryTarget: 'commonjs',
1616
path: path.join(__dirname, '.webpack'),
1717
filename: '[name].js'
1818
},

lib/validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ module.exports = {
136136
if (!this.webpackConfig.output || _.isEmpty(this.webpackConfig.output)) {
137137
const outputPath = path.join(this.serverless.config.servicePath, '.webpack');
138138
this.webpackConfig.output = {
139-
libraryTarget: 'commonjs2',
139+
libraryTarget: 'commonjs',
140140
path: outputPath,
141141
filename: '[name].js',
142142
};

tests/validate.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ describe('validate', () => {
183183
return module
184184
.validate()
185185
.then(() => expect(module.webpackConfig.output).to.eql({
186-
libraryTarget: 'commonjs2',
186+
libraryTarget: 'commonjs',
187187
path: path.join(testServicePath, '.webpack', 'service'),
188188
filename: '[name].js',
189189
}));
@@ -200,7 +200,7 @@ describe('validate', () => {
200200
return module
201201
.validate()
202202
.then(() => expect(module.webpackConfig.output).to.eql({
203-
libraryTarget: 'commonjs2',
203+
libraryTarget: 'commonjs',
204204
path: path.join(testServicePath, '.webpack', 'service'),
205205
filename: '[name].js',
206206
}));
@@ -214,7 +214,7 @@ describe('validate', () => {
214214
return module
215215
.validate()
216216
.then(() => expect(module.webpackConfig.output).to.eql({
217-
libraryTarget: 'commonjs2',
217+
libraryTarget: 'commonjs',
218218
path: path.join(testServicePath, '.webpack', 'service'),
219219
filename: '[name].js',
220220
}));
@@ -658,7 +658,7 @@ describe('validate', () => {
658658
devtool: 'source-map',
659659
context: 'some context',
660660
output: {
661-
libraryTarget: 'commonjs2'
661+
libraryTarget: 'commonjs'
662662
}
663663
}));
664664
module.serverless.service.functions = testFunctionsConfig;
@@ -674,10 +674,10 @@ describe('validate', () => {
674674
expect(module.webpackConfig[1].context).to.equal('some context');
675675
expect(module.webpackConfig[2].context).to.equal('some context');
676676
expect(module.webpackConfig[3].context).to.equal('some context');
677-
expect(module.webpackConfig[0].output.libraryTarget).to.equal('commonjs2');
678-
expect(module.webpackConfig[1].output.libraryTarget).to.equal('commonjs2');
679-
expect(module.webpackConfig[2].output.libraryTarget).to.equal('commonjs2');
680-
expect(module.webpackConfig[3].output.libraryTarget).to.equal('commonjs2');
677+
expect(module.webpackConfig[0].output.libraryTarget).to.equal('commonjs');
678+
expect(module.webpackConfig[1].output.libraryTarget).to.equal('commonjs');
679+
expect(module.webpackConfig[2].output.libraryTarget).to.equal('commonjs');
680+
expect(module.webpackConfig[3].output.libraryTarget).to.equal('commonjs');
681681
return null;
682682
});
683683
});

0 commit comments

Comments
 (0)