summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-01-15 11:50:26 -0600
committerMike Greiling <mike@pixelcog.com>2018-02-01 14:28:36 -0600
commit900124810cd8d456644b9722d5d703abc751f217 (patch)
tree115d2af0113a97bdba08b1bf11a1554f05b7dced /config
parenta24e58271aee485127724a9cc3058b7754e833d8 (diff)
downloadgitlab-ce-900124810cd8d456644b9722d5d703abc751f217.tar.gz
generate webpack entry points for pages directory automatically
Diffstat (limited to 'config')
-rw-r--r--config/webpack.config.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js
index 783677b5b8d..ed064be690c 100644
--- a/config/webpack.config.js
+++ b/config/webpack.config.js
@@ -3,6 +3,7 @@
var crypto = require('crypto');
var fs = require('fs');
var path = require('path');
+var glob = require('glob');
var webpack = require('webpack');
var StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin;
var CopyWebpackPlugin = require('copy-webpack-plugin');
@@ -20,6 +21,15 @@ var DEV_SERVER_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false';
var WEBPACK_REPORT = process.env.WEBPACK_REPORT;
var NO_COMPRESSION = process.env.NO_COMPRESSION;
+// generate automatic entry points
+var autoEntries = {};
+var pageEntries = glob.sync('pages/**/index.js', { cwd: path.join(ROOT_PATH, 'app/assets/javascripts') });
+
+pageEntries.forEach(( path ) => {
+ let chunkName = path.replace(/\/index\.js$/, '').replace(/\//g, '.');
+ autoEntries[chunkName] = './' + path;
+});
+
var config = {
// because sqljs requires fs.
node: {
@@ -301,6 +311,8 @@ var config = {
}
}
+config.entry = Object.assign({}, autoEntries, config.entry);
+
if (IS_PRODUCTION) {
config.devtool = 'source-map';
config.plugins.push(