Skip to content

Commit

Permalink
Update index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
didac-wh authored Feb 26, 2018
1 parent 55aa82b commit 8b28f3f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,16 @@ export class TypeScriptPlugin {
async copyExtras() {
// include node_modules into build
if (!fs.existsSync(path.resolve(path.join(buildFolder, 'node_modules')))) {
fs.symlinkSync(path.resolve('node_modules'), path.resolve(path.join(buildFolder, 'node_modules')))
try {
fs.symlinkSync(path.resolve('node_modules'), path.resolve(path.join(buildFolder, 'node_modules')))
} catch(error) {
// copy the folder when symlink failed
if(error.errno == -4048 && error.code == 'EPERM') {
fs.copySync(path.resolve('node_modules'), path.resolve(path.join(buildFolder, 'node_modules')));
} else {
throw error;
}
}
}

// include package.json into build so Serverless can exlcude devDeps during packaging
Expand Down

0 comments on commit 8b28f3f

Please sign in to comment.