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 @@ -19,7 +19,6 @@ const VUE_VERSION = require('vue/package const { ESBuildMinifyPlugin } = require('esbuild-loader'); const webpack = require('webpack'); -const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const { StatsWriterPlugin } = require('webpack-stats-plugin'); const WEBPACK_VERSION = require('webpack/package.json').version; const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); @@ -289,6 +288,8 @@ module.exports = { entry: generateEntries, + externals: [ 'canvas' ], + output: { path: WEBPACK_OUTPUT_PATH, publicPath: WEBPACK_PUBLIC_PATH, @@ -300,10 +301,15 @@ module.exports = { }, 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: [ @@ -436,7 +442,7 @@ module.exports = { }, { 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]', @@ -857,6 +863,7 @@ module.exports = { node: { fs: 'empty', // editorconfig requires 'fs' + Buffer: 'mock', setImmediate: false, }, }; --- a/app/assets/javascripts/pdf/index.vue +++ b/app/assets/javascripts/pdf/index.vue @@ -3,7 +3,7 @@ import { getDocument, GlobalWorkerOption import Page from './page/index.vue'; -GlobalWorkerOptions.workerSrc = '/assets/webpack/pdfjs/pdf.worker.min.js'; +GlobalWorkerOptions.workerSrc = '/assets/webpack/pdfjs/pdf.worker.js'; export default { components: { Page }, --- a/package.json +++ b/package.json @@ -49,8 +49,8 @@ "dependencies": { "@_ueberdosis/prosemirror-tables": "^1.1.3", "@apollo/client": "^3.5.10", - "@babel/core": "^7.18.5", - "@babel/preset-env": "^7.18.2", + "@babel/core": "link:/usr/share/nodejs/@babel/core", + "@babel/preset-env": "link:/usr/share/nodejs/@babel/preset-env", "@cubejs-client/core": "^0.31.15", "@cubejs-client/vue": "^0.31.19", "@gitlab/at.js": "1.5.7",