Browse Source

SONAR-14387 Remove support of legacy browser

tags/9.0.0.45539
Mathieu Suen 3 years ago
parent
commit
50b3f5db00

+ 0
- 1
server/sonar-docs/src/pages/requirements/requirements.md View File

@@ -62,7 +62,6 @@ To get the full experience SonarQube has to offer, you must enable JavaScript in

| Browser | |
| --------------------------- | --------------------------------------- |
| Microsoft Internet Explorer | ![](/images/check.svg) IE 11 |
| Microsoft Edge | ![](/images/check.svg) Latest |
| Mozilla Firefox | ![](/images/check.svg) Latest |
| Google Chrome | ![](/images/check.svg) Latest |

+ 0
- 74
server/sonar-web/config/webpack.config.js View File

@@ -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
)
})
];
};

+ 0
- 1
server/sonar-web/public/index.html View File

@@ -45,7 +45,6 @@
</script>
<% for (let chunk in htmlWebpackPlugin.files.chunks) { %>
<script type="module" src="%WEB_CONTEXT%/<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
<script nomodule src="%WEB_CONTEXT%/<%= htmlWebpackPlugin.files.chunks[chunk].entry.replace(/m\.[\w\d]+/, htmlWebpackPlugin.options.timestamp) %>"></script>
<% } %>
</body>


+ 1
- 4
server/sonar-web/scripts/build.js View File

@@ -41,10 +41,7 @@ function build() {
process.exit(1);
}
reportBuildStats(stats.stats[0], 'modern');
if (release) {
console.log();
reportBuildStats(stats.stats[1], 'legacy');
}

console.log(chalk.green.bold('Compiled successfully!'));
});
}

Loading…
Cancel
Save