From 90206399e25369da8d7783a553c8ed688680997e Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 29 Mar 2017 09:41:51 +0200 Subject: [PATCH] fix public paths for js chunks --- .../config/webpack/webpack.config.base.js | 7 ++++-- server/sonar-web/public/index.html | 4 ++-- .../src/main/js/app/utils/setPublicPath.js | 23 +++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 server/sonar-web/src/main/js/app/utils/setPublicPath.js diff --git a/server/sonar-web/config/webpack/webpack.config.base.js b/server/sonar-web/config/webpack/webpack.config.base.js index fe00c755bed..0de9ca39631 100644 --- a/server/sonar-web/config/webpack/webpack.config.base.js +++ b/server/sonar-web/config/webpack/webpack.config.base.js @@ -30,11 +30,14 @@ module.exports = { './src/main/js/libs/third-party/bootstrap/dropdown.js' ], - app: ['./src/main/js/app/index.js', './src/main/js/components/SourceViewer/SourceViewer.js'] + app: [ + './src/main/js/app/utils/setPublicPath.js', + './src/main/js/app/index.js', + './src/main/js/components/SourceViewer/SourceViewer.js' + ] }, output: { path: paths.appBuild, - publicPath: '/', filename: 'js/[name].[chunkhash:8].js', chunkFilename: 'js/[name].[chunkhash:8].chunk.js' }, diff --git a/server/sonar-web/public/index.html b/server/sonar-web/public/index.html index 34546eedeb8..f616d690eb0 100644 --- a/server/sonar-web/public/index.html +++ b/server/sonar-web/public/index.html @@ -23,7 +23,7 @@ <% for (var css in htmlWebpackPlugin.files.css) { %> - + <% } %> SonarQube @@ -31,7 +31,7 @@
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %> - + <% } %> diff --git a/server/sonar-web/src/main/js/app/utils/setPublicPath.js b/server/sonar-web/src/main/js/app/utils/setPublicPath.js new file mode 100644 index 00000000000..37eb5c6a3a4 --- /dev/null +++ b/server/sonar-web/src/main/js/app/utils/setPublicPath.js @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +/* eslint-disable no-undef */ +// make __webpack_public_path__ a free variable +// see https://github.com/webpack/webpack/issues/443 +__webpack_public_path__ = window.baseUrl + '/'; -- 2.39.5