201 lines
7.1 KiB
Diff
201 lines
7.1 KiB
Diff
Use debian packaged node modules when available
|
|
- Exclude packaged modules from transpiling
|
|
- Remove webpack-bundle-analyzer
|
|
- Resolve .json files
|
|
- Add more plugins to babel.config.js
|
|
- 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
|
|
|
|
--- a/config/webpack.config.js
|
|
+++ b/config/webpack.config.js
|
|
@@ -6,7 +6,6 @@
|
|
const StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin;
|
|
const CompressionPlugin = require('compression-webpack-plugin');
|
|
const MonacoWebpackPlugin = require('./plugins/monaco_webpack');
|
|
-const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
const vendorDllHash = require('./helpers/vendor_dll_hash');
|
|
|
|
@@ -152,6 +151,8 @@
|
|
|
|
entry: generateEntries,
|
|
|
|
+ externals: [ 'canvas' ],
|
|
+
|
|
output: {
|
|
path: path.join(ROOT_PATH, 'public/assets/webpack'),
|
|
publicPath: '/assets/webpack/',
|
|
@@ -161,13 +162,13 @@
|
|
},
|
|
|
|
resolve: {
|
|
- extensions: ['.js', '.gql', '.graphql'],
|
|
- modules: ['/usr/share/gitlab/node_modules','/usr/share/gitlab/node_modules/mermaid/node_modules', '/usr/lib/nodejs'],
|
|
+ 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: ['/usr/share/gitlab/node_modules', '/usr/lib/nodejs'],
|
|
+ modules: ['node_modules','/var/lib/gitlab/node_modules', '/usr/lib/nodejs','/usr/share/nodejs'],
|
|
},
|
|
|
|
module: {
|
|
@@ -180,9 +181,13 @@
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
- exclude: path =>
|
|
+ exclude: [ path =>
|
|
/node_modules\/(?!tributejs)|node_modules|vendor[\\/]assets/.test(path) &&
|
|
!/\.vue\.js/.test(path),
|
|
+ /\/usr\/share\/nodejs/,
|
|
+ /\/usr\/lib\/nodejs/,
|
|
+ /\/usr\/share\/javascript/
|
|
+ ],
|
|
loader: 'babel-loader',
|
|
options: {
|
|
cacheDirectory: path.join(CACHE_PATH, 'babel-loader'),
|
|
@@ -526,19 +531,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'),
|
|
- statsOptions: {
|
|
- source: false,
|
|
- },
|
|
- }),
|
|
-
|
|
new webpack.DefinePlugin({
|
|
// This one is used to define window.gon.ee and other things properly in tests:
|
|
'process.env.IS_EE': JSON.stringify(IS_EE),
|
|
@@ -574,6 +566,7 @@
|
|
|
|
node: {
|
|
fs: 'empty', // sqljs requires fs
|
|
+ Buffer: 'mock',
|
|
setImmediate: false,
|
|
},
|
|
};
|
|
--- a/package.json
|
|
+++ b/package.json
|
|
@@ -160,6 +160,64 @@
|
|
"xterm": "3.14.5"
|
|
},
|
|
"devDependencies": {
|
|
+ "@babel/plugin-transform-modules-commonjs": "^7.10.1",
|
|
+ "@gitlab/eslint-plugin": "4.0.0",
|
|
+ "@testing-library/dom": "^7.16.2",
|
|
+ "@vue/test-utils": "1.0.0-beta.30",
|
|
+ "acorn": "^6.3.0",
|
|
+ "axios-mock-adapter": "^1.15.0",
|
|
+ "babel-jest": "^26.5.2",
|
|
+ "babel-plugin-dynamic-import-node": "^2.3.3",
|
|
+ "babel-plugin-istanbul": "^6.0.0",
|
|
+ "chalk": "^2.4.1",
|
|
+ "commander": "^2.18.0",
|
|
+ "custom-jquery-matchers": "^2.1.0",
|
|
+ "docdash": "^1.0.2",
|
|
+ "eslint": "^6.8.0",
|
|
+ "eslint-import-resolver-jest": "^2.1.1",
|
|
+ "eslint-import-resolver-webpack": "^0.12.1",
|
|
+ "eslint-plugin-jasmine": "^4.1.0",
|
|
+ "eslint-plugin-no-jquery": "^2.3.0",
|
|
+ "gettext-extractor": "^3.4.3",
|
|
+ "gettext-extractor-vue": "^4.0.2",
|
|
+ "istanbul-lib-coverage": "^3.0.0",
|
|
+ "istanbul-lib-report": "^3.0.0",
|
|
+ "istanbul-reports": "^3.0.0",
|
|
+ "jasmine-core": "^2.9.0",
|
|
+ "jasmine-diff": "^0.1.3",
|
|
+ "jasmine-jquery": "^2.1.1",
|
|
+ "jest": "^26.5.2",
|
|
+ "jest-canvas-mock": "^2.1.2",
|
|
+ "jest-environment-jsdom": "^26.5.2",
|
|
+ "jest-junit": "^12.0.0",
|
|
+ "jest-util": "^26.5.2",
|
|
+ "jsdoc": "^3.5.5",
|
|
+ "jsdoc-vue": "^1.0.0",
|
|
+ "karma": "^4.2.0",
|
|
+ "karma-chrome-launcher": "^3.0.0",
|
|
+ "karma-coverage-istanbul-reporter": "^2.1.0",
|
|
+ "karma-jasmine": "^1.1.2",
|
|
+ "karma-junit-reporter": "^1.2.0",
|
|
+ "karma-mocha-reporter": "^2.2.5",
|
|
+ "karma-sourcemap-loader": "^0.3.7",
|
|
+ "karma-webpack": "^4.0.2",
|
|
+ "markdownlint-cli": "0.23.2",
|
|
+ "md5": "^2.2.1",
|
|
+ "node-sass": "^4.14.1",
|
|
+ "nodemon": "^2.0.4",
|
|
+ "pixelmatch": "^4.0.2",
|
|
+ "postcss": "^7.0.14",
|
|
+ "prettier": "1.18.2",
|
|
+ "readdir-enhanced": "^2.2.4",
|
|
+ "stylelint": "^10.1.0",
|
|
+ "stylelint-config-recommended": "^2.2.0",
|
|
+ "stylelint-scss": "^3.9.2",
|
|
+ "timezone-mock": "^1.0.8",
|
|
+ "vue-jest": "4.0.0-rc.0",
|
|
+ "webpack-dev-server": "^3.10.3",
|
|
+ "xhr-mock": "^2.5.1",
|
|
+ "yarn-check-webpack-plugin": "^1.2.0",
|
|
+ "yarn-deduplicate": "^1.1.1"
|
|
},
|
|
"blockedDependencies": {
|
|
"bootstrap-vue": "https://docs.gitlab.com/ee/development/fe_guide/dependencies.html#bootstrapvue"
|
|
--- a/babel.config.js
|
|
+++ b/babel.config.js
|
|
@@ -34,9 +34,12 @@
|
|
// 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',
|
|
+ '@babel/plugin-proposal-optional-chaining',
|
|
+ '@babel/plugin-proposal-nullish-coalescing-operator',
|
|
// See: https://gitlab.com/gitlab-org/gitlab/-/issues/229146
|
|
'@babel/plugin-transform-arrow-functions',
|
|
'lodash',
|
|
--- a/app/assets/javascripts/pdf/index.vue
|
|
+++ b/app/assets/javascripts/pdf/index.vue
|
|
@@ -1,6 +1,6 @@
|
|
<script>
|
|
import pdfjsLib from 'pdfjs-dist/build/pdf';
|
|
-import workerSrc from 'pdfjs-dist/build/pdf.worker.min';
|
|
+import workerSrc from 'pdfjs-dist/build/pdf.worker';
|
|
|
|
import page from './page/index.vue';
|
|
|
|
--- a/config/application.rb
|
|
+++ b/config/application.rb
|
|
@@ -218,7 +218,7 @@
|
|
config.assets.precompile << "illustrations/*.svg"
|
|
|
|
# Import Fontawesome fonts
|
|
- config.assets.paths << "#{config.root}/node_modules/font-awesome/fonts"
|
|
+ config.assets.paths << "/usr/share/nodejs/font-awesome/fonts"
|
|
config.assets.precompile << "fontawesome-webfont.woff2"
|
|
config.assets.precompile << "fontawesome-webfont.woff"
|
|
|