webpack.config.js

This commit is contained in:
Josh Goldberg
2017-12-28 22:51:09 -08:00
parent 1866b28aa1
commit d166dd6786
2 changed files with 55 additions and 2 deletions
+2 -2
View File
@@ -11,7 +11,7 @@
"description": "A path-based cache for quick lookups in nested data structures.",
"devDependencies": {
"@types/chai": "^4.0.4",
"@types/lolex": "^2.2.1",
"@types/lolex": "^2.1.1",
"@types/mocha": "^2.2.44",
"@types/sinon": "^4.0.0",
"@types/sinon-chai": "^2.7.29",
@@ -22,7 +22,7 @@
"mocha-headless-chrome": "^1.7.1",
"requirejs": "^2.3.5",
"run-for-every-file": "^1.1.0",
"shenanigans-manager": "^0.2.5",
"shenanigans-manager": "^0.2.6",
"sinon": "^4.1.2",
"sinon-chai": "^2.14.0",
"tslint": "5.8.0",
+53
View File
@@ -0,0 +1,53 @@
const glob = require("glob");
const path = require("path");
const package = require("./package.json");
const getEntriesAndSources = () => {
return package.shenanigans.entries === undefined
? [
{
entry: `./src/${package.shenanigans.name}.js`,
name: package.shenanigans.name,
sources: [
"./**/*.js",
"!./**/*.test.js",
]
}
]
: package.shenanigans.entries;
};
const getExternals = (shenanigans) => {
const output = {};
if (shenanigans.externals === undefined) {
return output;
}
for (const external of shenanigans.externals) {
output[external.name] = external.name;
}
return output;
};
const externals = getExternals(package.shenanigans);
const entriesAndSources = getEntriesAndSources();
const entry = {};
for (const pair of entriesAndSources) {
entry[pair.name] = pair.entry;
}
// multiple entries?
module.exports = {
entry, // IDictionary<string>
externals,
output: {
filename: "[name].js",
libraryTarget: "amd",
path: path.join(__dirname, "dist"),
}
};