aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/config
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2021-05-25 14:13:52 +0200
committersonartech <sonartech@sonarsource.com>2021-05-26 20:13:17 +0000
commit50b3f5db008f26197966b2e8778c4df9e7109749 (patch)
tree4bf098db28bcb6c02358b25944db7f788aa578c7 /server/sonar-web/config
parentb63595c8c4f57a9029bb4f4b29fe6422c35904a7 (diff)
downloadsonarqube-50b3f5db008f26197966b2e8778c4df9e7109749.tar.gz
sonarqube-50b3f5db008f26197966b2e8778c4df9e7109749.zip
SONAR-14387 Remove support of legacy browser
Diffstat (limited to 'server/sonar-web/config')
-rw-r--r--server/sonar-web/config/webpack.config.js74
1 files changed, 0 insertions, 74 deletions
diff --git a/server/sonar-web/config/webpack.config.js b/server/sonar-web/config/webpack.config.js
index d3e3db76a31..de4f583c043 100644
--- a/server/sonar-web/config/webpack.config.js
+++ b/server/sonar-web/config/webpack.config.js
@@ -29,30 +29,6 @@ const InterpolateHtmlPlugin = require('./InterpolateHtmlPlugin');
const paths = require('./paths');
const utils = require('./utils');
-/*
- This webpack config is actually two: one for modern browsers and one for the legacy ones (e.g. ie11)
-
- The modern one transpilies the code to ES2018 (i.e. with classes, async functions, etc.) and
- does not include any polyfills. It's included in the result index.html using <script type="module">.
- Legacy browsers ignore this tag.
-
- The legacy one transpilies the code to ES5 and polyfills ES5+ features (promises, generators, etc.).
- It's included in the result index.html using <script nomodule>. Modern browsers do not load such scripts.
-
- There is a trick to have both scripts in the index.html. We generate this file only once, during the
- build for modern browsers. We want unique file names for each version to invalidate browser cache.
- For modern browsers we generate a file suffix using the content hash (as previously). For legacy ones
- we can't do the same, because we need to know the file names without the build.
-
- To work-around the problem, we use a build timestamp which is added to the legacy build file names.
- This way assuming that the build generates exactly the same entry chunks, we know the name of the
- legacy files. Inside index.html template we use a simple regex to replace the file hash of a modern
- file name to the timestamp. To simplify the regex we use ".m." suffix for modern files.
-
- This whole thing might be simplified when (if) the following issue is resolved:
- https://github.com/jantimon/html-webpack-plugin/issues/1051
-*/
-
module.exports = ({ production = true, release = false }) => {
const timestamp = Date.now();
@@ -214,56 +190,6 @@ module.exports = ({ production = true, release = false }) => {
hints: 'error'
}
: undefined
- }),
-
- Object.assign({ name: 'legacy' }, commonConfig, {
- entry: [
- !production && require.resolve('react-dev-utils/webpackHotDevClient'),
- require.resolve('./polyfills'),
- !production && require.resolve('react-error-overlay'),
- './src/main/js/app/utils/setPublicPath.js',
- './src/main/js/app/index.ts'
- ].filter(Boolean),
- output: {
- path: paths.appBuild,
- pathinfo: !production,
- filename: production ? `js/[name].${timestamp}.js` : 'js/[name].js',
- chunkFilename: production ? `js/[name].${timestamp}.chunk.js` : 'js/[name].chunk.js'
- },
- module: {
- rules: [
- {
- test: /(\.js$|\.ts(x?)$)/,
- exclude: p => {
- // Transpile D3 packages.
- if (/\/d3/.test(p)) {
- return false;
- }
- // Ignore anything else in node_modules/.
- return /node_modules/.test(p);
- },
- use: [
- {
- loader: 'babel-loader',
- options: {
- configFile: path.join(__dirname, '../babel.config.legacy.js')
- }
- },
- {
- loader: 'ts-loader',
- options: {
- configFile: 'tsconfig.legacy.json',
- transpileOnly: true
- }
- }
- ]
- },
- ...commonRules
- ]
- },
- plugins: [...commonPlugins, !production && new webpack.HotModuleReplacementPlugin()].filter(
- Boolean
- )
})
];
};