Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make processed input path absolute #156

Merged
merged 3 commits into from
Jul 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ const wpwatch = require('./lib/wpwatch');
const cleanup = require('./lib/cleanup');
const run = require('./lib/run');
const serve = require('./lib/serve');
const makePathOptionAbsolute = require('./lib/makePathOptionAbsolute');
const packExternalModules = require('./lib/packExternalModules');

class ServerlessWebpack {
@@ -23,7 +24,8 @@ class ServerlessWebpack {
cleanup,
run,
serve,
packExternalModules
packExternalModules,
makePathOptionAbsolute
);

this.commands = {
@@ -90,7 +92,8 @@ class ServerlessWebpack {

'before:invoke:local:invoke': () => BbPromise.bind(this)
.then(this.validate)
.then(this.compile),
.then(this.compile)
.then(this.makePathOptionAbsolute),

'webpack:validate': () => BbPromise.bind(this)
.then(this.validate),
15 changes: 15 additions & 0 deletions lib/makePathOptionAbsolute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

const BbPromise = require('bluebird');
const path = require('path');

module.exports = {
makePathOptionAbsolute() {
const originalPath = this.serverless.config.serverless.processedInput.options.path;
if (originalPath) {
const absolutePath = path.resolve(originalPath);
this.serverless.config.serverless.processedInput.options.path = absolutePath;
};
return BbPromise.resolve();
}
};
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
@@ -35,5 +35,5 @@ function searchCache(moduleName, callback) {
module.exports = {
guid,
purgeCache,
searchCache,
searchCache
};