Skip to content

Commit 80bc997

Browse files
author
Frank Schmid
committed
Use package.disable to prevent packaging with SLS <= 1.17.
1 parent 8cd26b5 commit 80bc997

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/packageModules.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ const fs = require('fs');
88
const glob = require('glob');
99
const semver = require('semver');
1010

11-
function setArtifactPath(func, artifactPath) {
11+
function setArtifactPath(funcName, func, artifactPath) {
1212
const version = this.serverless.getVersion();
1313

1414
// Serverless changed the artifact path location in version 1.18
1515
if (semver.lt(version, '1.18.0')) {
1616
func.artifact = artifactPath;
17+
func.package = _.assign({}, func.package, { disable: true });
18+
this.serverless.cli.log(`${funcName} is packaged by the webpack plugin. Ignore messages from SLS.`);
1719
} else {
1820
func.package = {
1921
artifact: artifactPath,
@@ -87,7 +89,7 @@ module.exports = {
8789
this.serverless.cli.log(`Zip ${_.isEmpty(entryFunction) ? 'service' : 'function'}: ${modulePath} [${_.now() - startZip} ms]`))
8890
.then(artifactPath => {
8991
if (_.get(this.serverless, 'service.package.individually')) {
90-
setArtifactPath.call(this, entryFunction.func, path.relative(this.serverless.config.servicePath, artifactPath));
92+
setArtifactPath.call(this, entryFunction.funcName, entryFunction.func, path.relative(this.serverless.config.servicePath, artifactPath));
9193
}
9294
return artifactPath;
9395
});
@@ -98,7 +100,7 @@ module.exports = {
98100
const allFunctionNames = this.serverless.service.getAllFunctions();
99101
_.forEach(allFunctionNames, funcName => {
100102
const func = this.serverless.service.getFunction(funcName);
101-
setArtifactPath.call(this, func, path.relative(this.serverless.config.servicePath, artifacts[0]));
103+
setArtifactPath.call(this, funcName, func, path.relative(this.serverless.config.servicePath, artifacts[0]));
102104
});
103105
// For Google set the service artifact path
104106
if (_.get(this.serverless, 'service.provider.name') === 'google') {

0 commit comments

Comments
 (0)