From 873595337ec9f9c25dd455ebcbd0bd4876bc062e Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Fri, 23 Feb 2018 16:57:09 -0600 Subject: Remove sidebar bundle webpack entry point --- config/webpack.config.js | 1 - 1 file changed, 1 deletion(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index 0e96a2f6941..75ae657852b 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -72,7 +72,6 @@ var config = { protected_branches: './protected_branches', protected_tags: './protected_tags', registry_list: './registry/index.js', - sidebar: './sidebar/sidebar_bundle.js', snippet: './snippet/snippet_bundle.js', sketch_viewer: './blob/sketch_viewer.js', stl_viewer: './blob/stl_viewer.js', -- cgit v1.2.1 From 6358004b1c64ed3f8b83a75a672a0a72e1bee851 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 26 Feb 2018 16:05:24 +0000 Subject: Converted webpack_bundle_tag to be automatic webpack bundles --- config/webpack.config.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index be827903a6a..6383ac9d5e3 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -63,10 +63,8 @@ var config = { help: './help/help.js', merge_conflicts: './merge_conflicts/merge_conflicts_bundle.js', monitoring: './monitoring/monitoring_bundle.js', - network: './network/network_bundle.js', notebook_viewer: './blob/notebook_viewer.js', pdf_viewer: './blob/pdf_viewer.js', - pipelines: './pipelines/pipelines_bundle.js', pipelines_details: './pipelines/pipeline_details_bundle.js', profile: './profile/profile_bundle.js', project_import_gl: './projects/project_import_gitlab_project.js', @@ -79,7 +77,6 @@ var config = { stl_viewer: './blob/stl_viewer.js', terminal: './terminal/terminal_bundle.js', ui_development_kit: './ui_development_kit.js', - vue_merge_request_widget: './vue_merge_request_widget/index.js', two_factor_auth: './two_factor_auth.js', -- cgit v1.2.1 From a06152540794d247a34826313e7ab466bf5ee8bb Mon Sep 17 00:00:00 2001 From: Jacob Schatz Date: Mon, 26 Feb 2018 17:27:42 +0000 Subject: Remove webpack bundle tags for blob --- config/webpack.config.js | 1 - 1 file changed, 1 deletion(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index be827903a6a..05389a2a93f 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -51,7 +51,6 @@ var config = { context: path.join(ROOT_PATH, 'app/assets/javascripts'), entry: { balsamiq_viewer: './blob/balsamiq_viewer.js', - blob: './blob_edit/blob_bundle.js', common: './commons/index.js', common_vue: './vue_shared/vue_resource_interceptor.js', cycle_analytics: './cycle_analytics/cycle_analytics_bundle.js', -- cgit v1.2.1 From d434c62a83f5fe02f6eff3b9e311cba2eab38bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Mon, 26 Feb 2018 19:43:34 +0000 Subject: Move EE-specific JavaScript files to ee/app/assets/javascripts --- config/webpack.config.js | 1 + 1 file changed, 1 insertion(+) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index 05389a2a93f..665dbe012dc 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -309,6 +309,7 @@ var config = { 'images': path.join(ROOT_PATH, 'app/assets/images'), 'vendor': path.join(ROOT_PATH, 'vendor/assets/javascripts'), 'vue$': 'vue/dist/vue.esm.js', + 'spec': path.join(ROOT_PATH, 'spec/javascripts'), } } } -- cgit v1.2.1 From 7729a0ecc025c1ab8e6f0c8b5770fba8d254d831 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Mon, 26 Feb 2018 20:01:05 +0000 Subject: Refactor wildcard dispatcher imports --- config/webpack.config.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index 665dbe012dc..2b0c86c5e39 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -25,16 +25,10 @@ var NO_COMPRESSION = process.env.NO_COMPRESSION; var autoEntries = {}; var pageEntries = glob.sync('pages/**/index.js', { cwd: path.join(ROOT_PATH, 'app/assets/javascripts') }); -// filter out entries currently imported dynamically in dispatcher.js -var dispatcher = fs.readFileSync(path.join(ROOT_PATH, 'app/assets/javascripts/dispatcher.js')).toString(); -var dispatcherChunks = dispatcher.match(/(?!import\(')\.\/pages\/[^']+/g); - function generateAutoEntries(path, prefix = '.') { const chunkPath = path.replace(/\/index\.js$/, ''); - if (!dispatcherChunks.includes(`${prefix}/${chunkPath}`)) { - const chunkName = chunkPath.replace(/\//g, '.'); - autoEntries[chunkName] = `${prefix}/${path}`; - } + const chunkName = chunkPath.replace(/\//g, '.'); + autoEntries[chunkName] = `${prefix}/${path}`; } pageEntries.forEach(( path ) => generateAutoEntries(path)); -- cgit v1.2.1 From 4ebfa4b0ad34ea8766cfcbb1ac092e2b9348d773 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Mon, 26 Feb 2018 15:24:29 -0600 Subject: Remove commit_pipelines webpack entry point --- config/webpack.config.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index 05389a2a93f..732a89fb0a5 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -54,7 +54,6 @@ var config = { common: './commons/index.js', common_vue: './vue_shared/vue_resource_interceptor.js', cycle_analytics: './cycle_analytics/cycle_analytics_bundle.js', - commit_pipelines: './commit/pipelines/pipelines_bundle.js', diff_notes: './diff_notes/diff_notes_bundle.js', environments: './environments/environments_bundle.js', environments_folder: './environments/folder/environments_folder_bundle.js', @@ -244,7 +243,6 @@ var config = { name: 'common_vue', chunks: [ 'boards', - 'commit_pipelines', 'cycle_analytics', 'deploy_keys', 'diff_notes', -- cgit v1.2.1 From f3d06efcfd89c4d9bd80992df9e9b31958304999 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Mon, 26 Feb 2018 15:44:03 -0600 Subject: Remove environments folder webpack entry point --- config/webpack.config.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index 05389a2a93f..a5d14272411 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -57,7 +57,6 @@ var config = { commit_pipelines: './commit/pipelines/pipelines_bundle.js', diff_notes: './diff_notes/diff_notes_bundle.js', environments: './environments/environments_bundle.js', - environments_folder: './environments/folder/environments_folder_bundle.js', filtered_search: './filtered_search/filtered_search_bundle.js', help: './help/help.js', merge_conflicts: './merge_conflicts/merge_conflicts_bundle.js', @@ -249,7 +248,6 @@ var config = { 'deploy_keys', 'diff_notes', 'environments', - 'environments_folder', 'filtered_search', 'groups', 'merge_conflicts', -- cgit v1.2.1 From 2400c7bf4c3f69c46ce9c40b3c5c547b2e590dc5 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Mon, 26 Feb 2018 16:00:52 -0600 Subject: Remove diff notes webpack entry point --- config/webpack.config.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index 05389a2a93f..d0b17154978 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -55,7 +55,6 @@ var config = { common_vue: './vue_shared/vue_resource_interceptor.js', cycle_analytics: './cycle_analytics/cycle_analytics_bundle.js', commit_pipelines: './commit/pipelines/pipelines_bundle.js', - diff_notes: './diff_notes/diff_notes_bundle.js', environments: './environments/environments_bundle.js', environments_folder: './environments/folder/environments_folder_bundle.js', filtered_search: './filtered_search/filtered_search_bundle.js', @@ -247,7 +246,6 @@ var config = { 'commit_pipelines', 'cycle_analytics', 'deploy_keys', - 'diff_notes', 'environments', 'environments_folder', 'filtered_search', -- cgit v1.2.1 From c3564cd79ebabc7b2fd33dd43c9732e724e2e669 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 27 Feb 2018 17:06:35 +0000 Subject: Prevent webpack from rebooting while switching branches --- config/webpack.config.js | 77 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 25 deletions(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index 2cc89f325e5..5e70995c4ab 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -21,29 +21,28 @@ 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') }); - -function generateAutoEntries(path, prefix = '.') { - const chunkPath = path.replace(/\/index\.js$/, ''); - const chunkName = chunkPath.replace(/\//g, '.'); - autoEntries[chunkName] = `${prefix}/${path}`; -} +var autoEntriesCount = 0; +var watchAutoEntries = []; + +function generateEntries() { + // generate automatic entry points + var autoEntries = {}; + var pageEntries = glob.sync('pages/**/index.js', { cwd: path.join(ROOT_PATH, 'app/assets/javascripts') }); + watchAutoEntries = [ + path.join(ROOT_PATH, 'app/assets/javascripts/pages/'), + ]; + + function generateAutoEntries(path, prefix = '.') { + const chunkPath = path.replace(/\/index\.js$/, ''); + const chunkName = chunkPath.replace(/\//g, '.'); + autoEntries[chunkName] = `${prefix}/${path}`; + } -pageEntries.forEach(( path ) => generateAutoEntries(path)); + pageEntries.forEach(( path ) => generateAutoEntries(path)); -// report our auto-generated bundle count -var autoEntriesCount = Object.keys(autoEntries).length; -console.log(`${autoEntriesCount} entries from '/pages' automatically added to webpack output.`); + autoEntriesCount = Object.keys(autoEntries).length; -var config = { - // because sqljs requires fs. - node: { - fs: "empty" - }, - context: path.join(ROOT_PATH, 'app/assets/javascripts'), - entry: { + const manualEntries = { balsamiq_viewer: './blob/balsamiq_viewer.js', common: './commons/index.js', common_vue: './vue_shared/vue_resource_interceptor.js', @@ -79,7 +78,15 @@ var config = { test: './test.js', u2f: ['vendor/u2f'], webpack_runtime: './webpack.js', - }, + }; + + return Object.assign(manualEntries, autoEntries); +} + +var config = { + context: path.join(ROOT_PATH, 'app/assets/javascripts'), + + entry: generateEntries, output: { path: path.join(ROOT_PATH, 'public/assets/webpack'), @@ -296,10 +303,13 @@ var config = { 'vue$': 'vue/dist/vue.esm.js', 'spec': path.join(ROOT_PATH, 'spec/javascripts'), } - } -} + }, -config.entry = Object.assign({}, autoEntries, config.entry); + // sqljs requires fs + node: { + fs: 'empty', + }, +}; if (IS_PRODUCTION) { config.devtool = 'source-map'; @@ -336,7 +346,24 @@ if (IS_DEV_SERVER) { }; config.plugins.push( // watch node_modules for changes if we encounter a missing module compile error - new WatchMissingNodeModulesPlugin(path.join(ROOT_PATH, 'node_modules')) + new WatchMissingNodeModulesPlugin(path.join(ROOT_PATH, 'node_modules')), + + // watch for changes to our automatic entry point modules + { + apply(compiler) { + compiler.plugin('emit', (compilation, callback) => { + compilation.contextDependencies = [ + ...compilation.contextDependencies, + ...watchAutoEntries, + ]; + + // report our auto-generated bundle count + console.log(`${autoEntriesCount} entries from '/pages' automatically added to webpack output.`); + + callback(); + }) + }, + }, ); if (DEV_SERVER_LIVERELOAD) { config.plugins.push(new webpack.HotModuleReplacementPlugin()); -- cgit v1.2.1