Permalink
Browse files

Webpack entry points

Reads synchronously the lambda/ dir and create an entry point for each js file
  • Loading branch information...
rricard committed Nov 22, 2015
1 parent cf6e5dc commit 8ee9824857f734d77a5cfa95b3fea6d1947a7e00
Showing with 13 additions and 0 deletions.
  1. 0 lambdas/.gitkeep
  2. +13 −0 webpack.config.js
No changes.
@@ -1,6 +1,19 @@
var path = require("path");
var fs = require("fs");
module.exports = {
entry: fs.readdirSync(path.join(__dirname, "./lambdas"))
.filter(filename => /\.js$/.test(filename))
.map(filename => {
var entry = {};
entry[filename.replace(".js", "")] = path.join(
__dirname,
"./lambdas/",
filename
);
return entry;
})
.reduce((finalObject, entry) => Object.assign(finalObject, entry), {}),
output: {
path: path.join(__dirname, "dist"),
library: "[name]",

0 comments on commit 8ee9824

Please sign in to comment.