Use debian packaged node modules when available - Exclude packaged modules from transpiling - Remove webpack-bundle-analyzer - Resolve .json files - Add mkdirp 1.0 and loader-utils 2.0 to ensure compatibility for packaged modules (See #976310) - Use link protocol for modules with permission issues (which has a bin: entry in package.json) or dependencies. Use portal protocol only for modules that 1. does not have any other dependency and 2. does not have a bin: entry See https://github.com/yarnpkg/berry/issues/2266 - Even better, portal protocol tries to satisfy even devDependencies so avoid it - Modules with problems compression-webpack-plugin, copy-webpack-plugin, jszip, mkdirp, js-yaml, font-awesome, katex, cache-loader, webpack - babel-loader, cache-loader needs loader-utils 1.x and we already have 2.x and no compat patch - brace-expansion is a major version ahead in the archive - xterm build is broken (#980406) --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -16,7 +16,6 @@ const VUE_VERSION = require('vue/package.json').version; const webpack = require('webpack'); -const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const { StatsWriterPlugin } = require('webpack-stats-plugin'); const WEBPACK_VERSION = require('webpack/package.json').version; @@ -237,6 +236,8 @@ entry: generateEntries, + externals: [ 'canvas' ], + output: { path: WEBPACK_OUTPUT_PATH, publicPath: WEBPACK_PUBLIC_PATH, @@ -246,10 +247,15 @@ }, resolve: { - extensions: ['.js'], + extensions: ['.js', '.gql', '.graphql', '.json'], + modules: ['node_modules','/var/lib/gitlab/node_modules','/usr/share/gitlab/vendor/node_modules','/usr/share/gitlab/node_modules/mermaid/node_modules', '/usr/share/nodejs/markdown-it/node_modules/', '/usr/lib/nodejs', '/usr/share/nodejs'], alias, }, + resolveLoader: { + modules: ['node_modules','/var/lib/gitlab/node_modules', '/usr/lib/nodejs','/usr/share/nodejs'], + }, + module: { strictExportPresence: true, rules: [ @@ -348,7 +354,7 @@ }, { test: /\.(eot|ttf|woff|woff2)$/, - include: /node_modules\/(katex\/dist\/fonts|monaco-editor)/, + include: /(node_modules\/monaco-editor|\/usr\/share\/fonts\/truetype\/katex)/, loader: 'file-loader', options: { name: '[name].[contenthash:8].[ext]', @@ -659,19 +665,6 @@ }, }, - // 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'), - statsOptions: { - source: false, - }, - }), - new webpack.DefinePlugin({ // These are used to define window.gon.ee, window.gon.jh and other things properly in tests: 'process.env.IS_EE': JSON.stringify(IS_EE), @@ -739,6 +732,7 @@ node: { fs: 'empty', // editorconfig requires 'fs' + Buffer: 'mock', setImmediate: false, }, }; --- a/babel.config.js +++ b/babel.config.js @@ -14,6 +14,7 @@ // include stage 3 proposals const plugins = [ '@babel/plugin-syntax-import-meta', + '@babel/plugin-syntax-dynamic-import', '@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-json-strings', '@babel/plugin-proposal-private-methods', --- a/app/assets/javascripts/pdf/index.vue +++ b/app/assets/javascripts/pdf/index.vue @@ -1,6 +1,6 @@