lib/classes/Service.js/Service/load
class Service:  load(rawOptions) {
    const that = this;
    const options = rawOptions || {};
    options.stage = options.stage || options.s;
    options.region = options.region || options.r;
    const servicePath = this.serverless.config.servicePath;

    // skip if the service path is not found
    // because the user might be creating a new service
    if (!servicePath) {
      return BbPromise.resolve();
    }

    // List of supported service filename variants.
    // The order defines the precedence.
    const serviceFilenames = [
      'serverless.yaml',
      'serverless.yml',
      'serverless.json',
      'serverless.js',
    ];

    const serviceFilePaths = _.map(serviceFilenames, filename => path.join(servicePath, filename));
    const serviceFileIndex = _.findIndex(serviceFilePaths,
      filename => this.serverless.utils.fileExistsSync(filename)
    );

    // Set the filename if found, otherwise set the preferred variant.
    const serviceFilePath = serviceFileIndex !== -1 ?
      serviceFilePaths[serviceFileIndex] :
      _.first(serviceFilePaths);
    const serviceFilename = serviceFileIndex !== -1 ?
      serviceFilenames[serviceFileIndex] :
      _.first(serviceFilenames);

    if (serviceFilename === 'serverless.js') {
      return BbPromise.try(() => {
        // use require to load serverless.js file
        // eslint-disable-next-line global-require
        const config = require(serviceFilePath);

        if (!_.isPlainObject(config)) {
          throw new Error('serverless.js must export plain object');
        }

        return that.loadServiceFileParam(serviceFilename, config);
      });
    }

    return that.serverless.yamlParser
      .parse(serviceFilePath)
      .then((serverlessFileParam) =>
        that.loadServiceFileParam(serviceFilename, serverlessFileParam)
      );
  }