]> source.dussan.org Git - sonarqube.git/commitdiff
fix public paths for js chunks
authorStas Vilchik <vilchiks@gmail.com>
Wed, 29 Mar 2017 07:41:51 +0000 (09:41 +0200)
committerStas Vilchik <stas-vilchik@users.noreply.github.com>
Wed, 29 Mar 2017 14:01:38 +0000 (16:01 +0200)
server/sonar-web/config/webpack/webpack.config.base.js
server/sonar-web/public/index.html
server/sonar-web/src/main/js/app/utils/setPublicPath.js [new file with mode: 0644]

index fe00c755bedbe6deaf8523c9e07c92d7c3f3f6e4..0de9ca396318764c0bf99d3b5ca36a7bee23cfd0 100644 (file)
@@ -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'
   },
index 34546eedeb8b2eff10eec257a7f67bc3eee95bfb..f616d690eb0a06c14f72c1045dde34359ef74434 100644 (file)
@@ -23,7 +23,7 @@
     <meta name="msapplication-TileImage" content="%WEB_CONTEXT%/mstile-512x512.png" />
 
     <% for (var css in htmlWebpackPlugin.files.css) { %>
-    <link href="%WEB_CONTEXT%<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
+    <link href="%WEB_CONTEXT%/<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
     <% } %>
     <title>SonarQube</title>
   </head>
@@ -31,7 +31,7 @@
     <div id="content"></div>
     <script>window.baseUrl = '%WEB_CONTEXT%';</script>
     <% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
-    <script src="%WEB_CONTEXT%<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
+    <script src="%WEB_CONTEXT%/<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
     <% } %>
   </body>
 </html>
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 (file)
index 0000000..37eb5c6
--- /dev/null
@@ -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 + '/';