diff --git a/index.js b/index.js index 378a76b..2bc9f33 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,7 @@ module.exports = function getPlugin(ServerlessPlugin) { const func = this.S.state.getFunctions({ paths: [evt.options.path] })[0]; const component = func.getComponent(); - if (component.runtime === 'nodejs') { + if (component.runtime.indexOf('nodejs') === 0) { const projectPath = this.S.config.projectPath; const config = getConfig(projectPath, component, func); diff --git a/lib/bundle.js b/lib/bundle.js index f5d02ab..9b35d82 100644 --- a/lib/bundle.js +++ b/lib/bundle.js @@ -3,6 +3,7 @@ const path = require('path'); const webpack = require('./webpack'); const getExternalsFromStats = require('./getExternalsFromStats'); const getExternalModulePaths = require('./getExternalModulePaths'); +const fs = require('fs'); module.exports = function bundle(config, pathDist, component, func) { @@ -42,6 +43,11 @@ module.exports = function bundle(config, pathDist, component, func) { path: `${pathBundled}.map` }); } + fs.writeFile(path.join(pathDist, 'stats.json'), JSON.stringify(stats.toJson({json: true})), function(err){ + if(err){ + console.log(err); + } + }); // Reassign pathsPackages property const externals = getExternalsFromStats(stats);