From 230c338a5a05b5211d51f6a2be4a1f649423ccee Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 22 Nov 2020 12:28:24 +0100 Subject: [PATCH] webpack: Simplify module.entries Drop the "qualify" loop and add the src/ subdirectory to the path directly. This is more explicit, thus easier to understand, and simpler. Also move it into the `modules` declaration directly, so that (1) it's easier to see what it actually means, and (2) info.files is for a completely different purpose. --- webpack.config.js | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 9ce0c4b..c5b83b7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -15,11 +15,6 @@ const nodedir = path.resolve((process.env.SRCDIR || __dirname), "node_modules"); var production = process.env.NODE_ENV === 'production'; var info = { - entries: { - "index": [ - "./index.js" - ] - }, files: [ "index.html", "manifest.json", @@ -43,21 +38,6 @@ function vpath(/* ... */) { return expanded; } -/* Qualify all the paths in entries */ -Object.keys(info.entries).forEach(function(key) { - if (section && key.indexOf(section) !== 0) { - delete info.entries[key]; - return; - } - - info.entries[key] = info.entries[key].map(function(value) { - if (value.indexOf("/") === -1) - return value; - else - return vpath(value); - }); -}); - /* Qualify all the paths in files listed */ var files = []; info.files.forEach(function(value) { @@ -110,7 +90,9 @@ module.exports = { watchOptions: { ignored: /node_modules/, }, - entry: info.entries, + entry: { + index: "./src/index.js", + }, // cockpit.js gets included via