debian-mirror-gitlab/debian/patches/nodejs/0040-use-packaged-modules.patch

106 lines
3.7 KiB
Diff
Raw Normal View History

2020-04-13 13:49:04 +05:30
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)
2020-04-13 13:49:04 +05:30
2019-08-08 15:17:34 +05:30
--- a/config/webpack.config.js
+++ b/config/webpack.config.js
2022-11-26 12:48:29 +05:30
@@ -19,7 +19,6 @@
const { ESBuildMinifyPlugin } = require('esbuild-loader');
2021-10-01 04:34:20 +05:30
2021-04-17 20:43:06 +05:30
const webpack = require('webpack');
-const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { StatsWriterPlugin } = require('webpack-stats-plugin');
const WEBPACK_VERSION = require('webpack/package.json').version;
2022-11-26 12:48:29 +05:30
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
2023-03-05 00:11:28 +05:30
@@ -289,6 +288,8 @@
entry: generateEntries,
+ externals: [ 'canvas' ],
+
output: {
2021-02-22 22:40:45 +05:30
path: WEBPACK_OUTPUT_PATH,
publicPath: WEBPACK_PUBLIC_PATH,
2023-03-05 00:11:28 +05:30
@@ -300,10 +301,15 @@
},
2019-08-08 15:17:34 +05:30
resolve: {
2021-06-09 22:52:32 +05:30
- 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'],
2019-08-08 15:17:34 +05:30
alias,
},
2021-06-09 22:52:32 +05:30
+ resolveLoader: {
+ modules: ['node_modules','/var/lib/gitlab/node_modules', '/usr/lib/nodejs','/usr/share/nodejs'],
2021-06-09 22:52:32 +05:30
+ },
+
2019-08-08 15:17:34 +05:30
module: {
2021-06-09 22:52:32 +05:30
strictExportPresence: true,
rules: [
2023-03-05 00:11:28 +05:30
@@ -419,7 +425,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]',
2023-03-05 00:11:28 +05:30
@@ -840,6 +846,7 @@
2019-08-08 15:17:34 +05:30
node: {
2022-06-22 00:40:03 +05:30
fs: 'empty', // editorconfig requires 'fs'
+ Buffer: 'mock',
setImmediate: false,
},
2019-08-08 15:17:34 +05:30
};
2022-06-22 00:40:03 +05:30
--- a/app/assets/javascripts/pdf/index.vue
+++ b/app/assets/javascripts/pdf/index.vue
2022-11-26 12:48:29 +05:30
@@ -3,7 +3,7 @@
2022-06-22 00:40:03 +05:30
2022-10-18 15:59:10 +05:30
import Page from './page/index.vue';
2022-06-22 00:40:03 +05:30
2022-11-26 12:48:29 +05:30
-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
2023-03-05 00:11:28 +05:30
@@ -49,8 +49,8 @@
2021-04-21 01:01:41 +05:30
"dependencies": {
2022-08-27 14:03:50 +05:30
"@_ueberdosis/prosemirror-tables": "^1.1.3",
2022-06-22 00:40:03 +05:30
"@apollo/client": "^3.5.10",
2022-07-29 18:21:45 +05:30
- "@babel/core": "^7.18.5",
- "@babel/preset-env": "^7.18.2",
2021-04-21 01:01:41 +05:30
+ "@babel/core": "link:/usr/share/nodejs/@babel/core",
+ "@babel/preset-env": "link:/usr/share/nodejs/@babel/preset-env",
2022-09-04 06:12:58 +05:30
"@codesandbox/sandpack-client": "^1.2.2",
2023-03-05 00:11:28 +05:30
"@cubejs-client/core": "^0.31.0",
2021-04-21 01:01:41 +05:30
"@gitlab/at.js": "1.5.7",
2023-03-05 00:11:28 +05:30
@@ -60,7 +60,7 @@
"@gitlab/ui": "52.6.0",
2022-07-16 23:52:05 +05:30
"@gitlab/visual-review-tools": "1.7.3",
2023-03-05 00:11:28 +05:30
"@gitlab/web-ide": "0.0.1-dev-20221217175648",
2022-06-22 00:40:03 +05:30
- "@rails/actioncable": "6.1.4-7",
2021-05-10 01:10:00 +05:30
+ "@rails/actioncable": "link:/usr/share/nodejs/@rails/actioncable",
2022-06-22 00:40:03 +05:30
"@rails/ujs": "6.1.4-7",
2023-01-13 00:17:06 +05:30
"@sourcegraph/code-host-integration": "0.0.84",
2023-03-05 00:11:28 +05:30
"@tiptap/core": "^2.0.0-beta.182",