From 72723286f7335498bcb1f505431d1b6c13fe9913 Mon Sep 17 00:00:00 2001 From: Pirate Praveen Date: Thu, 8 Aug 2019 15:17:34 +0530 Subject: [PATCH] Switch to packaged version of webpack --- debian/control | 1 + .../patches/0740-use-packaged-modules.patch | 59 +++++++++++++++++-- debian/rake-tasks.sh | 4 +- 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/debian/control b/debian/control index ab3954b045..7aabbb86b2 100644 --- a/debian/control +++ b/debian/control @@ -349,6 +349,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, node-timeago.js, node-underscore, node-vue-resource (>= 1.5.1~), + webpack (>= 4~), node-webpack-stats-plugin, # using npm for remaining as it is in contrib # node-babel-core, diff --git a/debian/patches/0740-use-packaged-modules.patch b/debian/patches/0740-use-packaged-modules.patch index 7d160f62cb..55ea5bf03c 100644 --- a/debian/patches/0740-use-packaged-modules.patch +++ b/debian/patches/0740-use-packaged-modules.patch @@ -67,7 +67,7 @@ "raw-loader": "^1.0.0", "sanitize-html": "^1.16.1", "select2": "3.5.2-browserify", -@@ -113,19 +81,14 @@ +@@ -113,27 +81,18 @@ "stylelint-error-string-formatter": "1.0.2", "svg4everybody": "2.1.9", "three": "^0.84.0", @@ -87,10 +87,10 @@ "vue-router": "^3.0.2", "vue-template-compiler": "^2.6.10", "vue-virtual-scroll-list": "^1.3.1", -@@ -133,7 +96,6 @@ - "webpack": "^4.29.0", - "webpack-bundle-analyzer": "^3.0.3", - "webpack-cli": "^3.2.1", + "vuex": "^3.1.0", +- "webpack": "^4.29.0", +- "webpack-bundle-analyzer": "^3.0.3", +- "webpack-cli": "^3.2.1", - "webpack-stats-plugin": "^0.2.1", "worker-loader": "^2.0.0", "xterm": "^3.5.0" @@ -106,3 +106,52 @@ @import "../../../node_modules/dropzone/dist/basic"; @import "../../../node_modules/select2/select2"; +--- a/config/webpack.config.js ++++ b/config/webpack.config.js +@@ -5,7 +5,6 @@ + const StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin; + const CompressionPlugin = require('compression-webpack-plugin'); + const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); +-const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; + + const ROOT_PATH = '/usr/share/gitlab'; + const CACHE_PATH = process.env.WEBPACK_CACHE_PATH || path.join(ROOT_PATH, 'tmp/cache'); +@@ -119,12 +118,12 @@ + + resolve: { + extensions: ['.js', '.gql', '.graphql'], +- modules: ['/usr/share/gitlab/node_modules','/usr/share/gitlab/node_modules/mermaid/node_modules', '/usr/lib/nodejs'], ++ modules: ['/usr/share/gitlab/node_modules','/usr/share/gitlab/node_modules/mermaid/node_modules', '/usr/lib/nodejs', '/usr/share/nodejs'], + alias, + }, + + resolveLoader: { +- modules: ['/usr/share/gitlab/node_modules', '/usr/lib/nodejs'], ++ modules: ['/usr/share/gitlab/node_modules', '/usr/lib/nodejs','/usr/share/nodejs'], + }, + + module: { +@@ -316,16 +315,6 @@ + // enable HMR only in webpack-dev-server + DEV_SERVER_LIVERELOAD && new webpack.HotModuleReplacementPlugin(), + +- // optionally generate webpack bundle analysis +- WEBPACK_REPORT && +- new BundleAnalyzerPlugin({ +- analyzerMode: 'static', +- generateStatsFile: true, +- openAnalyzer: false, +- reportFilename: path.join(ROOT_PATH, 'webpack-report/index.html'), +- statsFilename: path.join(ROOT_PATH, 'webpack-report/stats.json'), +- }), +- + new webpack.DefinePlugin({ + 'process.env.IS_GITLAB_EE': JSON.stringify(IS_EE), + }), +@@ -347,5 +336,5 @@ + devtool: NO_SOURCEMAPS ? false : devtool, + + // sqljs requires fs +- node: { fs: 'empty' }, ++ node: { fs: 'empty', Buffer: "mock" }, + }; diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh index 054d83dbc3..8fa800c639 100755 --- a/debian/rake-tasks.sh +++ b/debian/rake-tasks.sh @@ -42,6 +42,4 @@ echo "Precompiling assets..." runuser -u ${gitlab_user} -- sh -c '/usr/bin/bundle exec rake tmp:cache:clear assets:precompile' echo "Webpacking..." -#runuser -u ${gitlab_user} -- sh -c 'rm -rf node_modules/webpack' -#runuser -u ${gitlab_user} -- sh -c 'rm -rf node_modules/webpack-bundle-analyzer' -runuser -u ${gitlab_user} -- sh -c 'node_modules/.bin/webpack --config config/webpack.config.js' +runuser -u ${gitlab_user} -- sh -c 'webpack --config config/webpack.config.js'