Skip to content
Open
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
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,18 @@ class ServerlessPlugin {
// unzip2 actually emits close when completed. When unzipping a large file, using finish will cause this plugin to run prematurely
stream.on('close', () => {
// compile
const plugins = this.serverless.service.custom.babelPlugins || [];
const args = [
'--out-dir=tmpBabelDirectory',
'tmpBabelDirectory',
'--ignore=node_modules',
`--presets=${this.serverless.service.custom.babelPresets.join(',')}`,
`--plugins=${this.serverless.service.custom.babelPlugins.join(',')}`,
`--plugins=${plugins.join(',')}`,
];
const options = {
cwd: path.join(servicePath, '.serverless'),
};
const execPath = path.join(__dirname, '..', '.bin/babel');
let execPath = path.join(__dirname, '..', '.bin/babel');
console.log('Babel Executable: ' + execPath);
if (isWin) execPath += '.cmd';
const result = spawnSync(execPath, args, options);
Expand Down