From 02504f2f9c8f0316b9235121f9677a998136bfc4 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 10 Feb 2017 00:45:42 -0600 Subject: use deterministic module IDs in production and development --- config/webpack.config.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index 13273902b0e..d06f7733945 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -83,6 +83,10 @@ var config = { assets: true }), new webpack.IgnorePlugin(/moment/, /pikaday/), + // use deterministic module ids in all environments + IS_PRODUCTION ? + new webpack.HashedModuleIdsPlugin() : + new webpack.NamedModulesPlugin(), ], resolve: { -- cgit v1.2.1 From e80fa69895dadfbd5cdc95f7feb9593cfe52e9b6 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 1 Mar 2017 15:47:52 -0600 Subject: update plugin formatting --- config/webpack.config.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index d06f7733945..cbf59276dce 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -82,7 +82,10 @@ var config = { modules: false, assets: true }), + + // prevent pikaday from including moment.js new webpack.IgnorePlugin(/moment/, /pikaday/), + // use deterministic module ids in all environments IS_PRODUCTION ? new webpack.HashedModuleIdsPlugin() : -- cgit v1.2.1 From cb6c036d8942ab24048b9ecebcc6c3fa408c9a3e Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 1 Mar 2017 16:01:33 -0600 Subject: create a common.js bundle and include all jQuery plugins --- config/webpack.config.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index cbf59276dce..c2e0e86fb78 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -17,6 +17,7 @@ var WEBPACK_REPORT = process.env.WEBPACK_REPORT; var config = { context: path.join(ROOT_PATH, 'app/assets/javascripts'), entry: { + common: './commons/index.js', application: './application.js', blob_edit: './blob_edit/blob_edit_bundle.js', boards: './boards/boards_bundle.js', @@ -90,13 +91,18 @@ var config = { IS_PRODUCTION ? new webpack.HashedModuleIdsPlugin() : new webpack.NamedModulesPlugin(), + + // create a common.js bundle to be loaded on every page + new webpack.optimize.CommonsChunkPlugin({ + name: 'common', + minChunks: Infinity, + }), ], resolve: { extensions: ['.js', '.es6', '.js.es6'], alias: { '~': path.join(ROOT_PATH, 'app/assets/javascripts'), - 'bootstrap/js': 'bootstrap-sass/assets/javascripts/bootstrap', 'emoji-aliases$': path.join(ROOT_PATH, 'fixtures/emojis/aliases.json'), 'icons': path.join(ROOT_PATH, 'app/views/shared/icons'), 'vendor': path.join(ROOT_PATH, 'vendor/assets/javascripts'), -- cgit v1.2.1 From 7371f6cd8c168df41e4197f80f53f3c04185dee7 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 1 Mar 2017 17:02:01 -0600 Subject: refactor common bundle to ES module syntax and move global exports to application.js --- config/webpack.config.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index c2e0e86fb78..a76daa2ba95 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -87,6 +87,12 @@ var config = { // prevent pikaday from including moment.js new webpack.IgnorePlugin(/moment/, /pikaday/), + // fix legacy jQuery plugins which depend on globals + new webpack.ProvidePlugin({ + $: 'jquery', + jQuery: 'jquery', + }), + // use deterministic module ids in all environments IS_PRODUCTION ? new webpack.HashedModuleIdsPlugin() : -- cgit v1.2.1 From ba865db378b12265442c008a6fc167f2c3c910fb Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Mar 2017 00:35:44 -0600 Subject: separate webpack runtime into its own chunk to maintain cacheability of common chunk --- config/webpack.config.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index a76daa2ba95..f262286f5f8 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -98,10 +98,9 @@ var config = { new webpack.HashedModuleIdsPlugin() : new webpack.NamedModulesPlugin(), - // create a common.js bundle to be loaded on every page + // create cacheable common library bundles new webpack.optimize.CommonsChunkPlugin({ - name: 'common', - minChunks: Infinity, + names: ['application', 'common', 'manifest'], }), ], -- cgit v1.2.1 From 7f22c39a25b5424ab1fd7905654667a697c82aeb Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 1 Mar 2017 20:28:34 -0600 Subject: create a cacheable commons bundle for our Vue bundles --- config/webpack.config.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index f262286f5f8..cdae80550dc 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -18,6 +18,7 @@ var config = { context: path.join(ROOT_PATH, 'app/assets/javascripts'), entry: { common: './commons/index.js', + common_vue: ['vue', 'vue-resource'], application: './application.js', blob_edit: './blob_edit/blob_edit_bundle.js', boards: './boards/boards_bundle.js', @@ -41,7 +42,6 @@ var config = { users: './users/users_bundle.js', lib_chart: './lib/chart.js', lib_d3: './lib/d3.js', - lib_vue: './lib/vue_resource.js', vue_pipelines: './vue_pipelines_index/index.js', }, @@ -98,6 +98,23 @@ var config = { new webpack.HashedModuleIdsPlugin() : new webpack.NamedModulesPlugin(), + // create cacheable common library bundle for all vue chunks + new webpack.optimize.CommonsChunkPlugin({ + name: 'common_vue', + chunks: [ + 'boards', + 'commit_pipelines', + 'cycle_analytics', + 'diff_notes', + 'environments', + 'environments_folder', + 'issuable', + 'merge_conflicts', + 'vue_pipelines', + ], + minChunks: Infinity, + }), + // create cacheable common library bundles new webpack.optimize.CommonsChunkPlugin({ names: ['application', 'common', 'manifest'], -- cgit v1.2.1 From 5f464f98f1ff86caac02eca207704c1961b07be1 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Mar 2017 00:58:47 -0600 Subject: include vue_shared scripts within common_vue chunk --- config/webpack.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index cdae80550dc..904ac36df4c 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -112,7 +112,9 @@ var config = { 'merge_conflicts', 'vue_pipelines', ], - minChunks: Infinity, + minChunks: function(module, count) { + return module.resource && (/vue_shared/).test(module.resource); + }, }), // create cacheable common library bundles -- cgit v1.2.1 From 1f9743310054273b98e423b6dc5e99a5bc9fd7a2 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Mar 2017 01:27:52 -0600 Subject: merge lib_chart into graphs bundle --- 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 904ac36df4c..243007be4b7 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -40,7 +40,6 @@ var config = { snippet: './snippet/snippet_bundle.js', terminal: './terminal/terminal_bundle.js', users: './users/users_bundle.js', - lib_chart: './lib/chart.js', lib_d3: './lib/d3.js', vue_pipelines: './vue_pipelines_index/index.js', }, -- cgit v1.2.1 From ec9180719ef3d8a3d2aa6bc67b2ec31f91c57613 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Mar 2017 01:34:36 -0600 Subject: create a cacheable commons bundle for d3 library --- config/webpack.config.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index 243007be4b7..eb453b5997b 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -19,6 +19,7 @@ var config = { entry: { common: './commons/index.js', common_vue: ['vue', 'vue-resource'], + common_d3: ['d3'], application: './application.js', blob_edit: './blob_edit/blob_edit_bundle.js', boards: './boards/boards_bundle.js', @@ -40,7 +41,6 @@ var config = { snippet: './snippet/snippet_bundle.js', terminal: './terminal/terminal_bundle.js', users: './users/users_bundle.js', - lib_d3: './lib/d3.js', vue_pipelines: './vue_pipelines_index/index.js', }, @@ -116,6 +116,12 @@ var config = { }, }), + // create cacheable common library bundle for all d3 chunks + new webpack.optimize.CommonsChunkPlugin({ + name: 'common_d3', + chunks: ['graphs', 'users'], + }), + // create cacheable common library bundles new webpack.optimize.CommonsChunkPlugin({ names: ['application', 'common', 'manifest'], -- cgit v1.2.1 From d0d34786e9bdda51dfecc59a419082db8c523ddc Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Mar 2017 17:00:48 -0600 Subject: rename application entry point and change manifest to runtime --- config/webpack.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'config/webpack.config.js') diff --git a/config/webpack.config.js b/config/webpack.config.js index eb453b5997b..d9fa70c29fb 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -20,7 +20,7 @@ var config = { common: './commons/index.js', common_vue: ['vue', 'vue-resource'], common_d3: ['d3'], - application: './application.js', + main: './main.js', blob_edit: './blob_edit/blob_edit_bundle.js', boards: './boards/boards_bundle.js', simulate_drag: './test_utils/simulate_drag.js', @@ -47,7 +47,7 @@ var config = { output: { path: path.join(ROOT_PATH, 'public/assets/webpack'), publicPath: '/assets/webpack/', - filename: IS_PRODUCTION ? '[name]-[chunkhash].js' : '[name].js' + filename: IS_PRODUCTION ? '[name].[chunkhash].bundle.js' : '[name].bundle.js' }, devtool: 'inline-source-map', @@ -124,7 +124,7 @@ var config = { // create cacheable common library bundles new webpack.optimize.CommonsChunkPlugin({ - names: ['application', 'common', 'manifest'], + names: ['main', 'common', 'runtime'], }), ], -- cgit v1.2.1