Browse Source

fix for issue with error view in production builds

Torkel Ödegaard 7 years ago
parent
commit
34c70ca7ce
3 changed files with 7 additions and 6 deletions
  1. 1 0
      pkg/middleware/recovery.go
  2. 1 1
      scripts/webpack/webpack.dev.js
  3. 5 5
      scripts/webpack/webpack.prod.js

+ 1 - 0
pkg/middleware/recovery.go

@@ -115,6 +115,7 @@ func Recovery() macaron.Handler {
 
 
 				c.Data["Title"] = "Server Error"
 				c.Data["Title"] = "Server Error"
 				c.Data["AppSubUrl"] = setting.AppSubUrl
 				c.Data["AppSubUrl"] = setting.AppSubUrl
+				c.Data["Theme"] = setting.DefaultTheme
 
 
 				if setting.Env == setting.DEV {
 				if setting.Env == setting.DEV {
 					if theErr, ok := err.(error); ok {
 					if theErr, ok := err.(error); ok {

+ 1 - 1
scripts/webpack/webpack.dev.js

@@ -85,7 +85,7 @@ module.exports = merge(common, {
     new HtmlWebpackPlugin({
     new HtmlWebpackPlugin({
       filename: path.resolve(__dirname, '../../public/views/error.html'),
       filename: path.resolve(__dirname, '../../public/views/error.html'),
       template: path.resolve(__dirname, '../../public/views/error-template.html'),
       template: path.resolve(__dirname, '../../public/views/error-template.html'),
-      inject: 'false',
+      inject: false,
     }),
     }),
     new HtmlWebpackPlugin({
     new HtmlWebpackPlugin({
       filename: path.resolve(__dirname, '../../public/views/index.html'),
       filename: path.resolve(__dirname, '../../public/views/index.html'),

+ 5 - 5
scripts/webpack/webpack.prod.js

@@ -74,17 +74,17 @@ module.exports = merge(common, {
       filename: "grafana.[name].[hash].css"
       filename: "grafana.[name].[hash].css"
     }),
     }),
     new ngAnnotatePlugin(),
     new ngAnnotatePlugin(),
+    new HtmlWebpackPlugin({
+      filename: path.resolve(__dirname, '../../public/views/error.html'),
+      template: path.resolve(__dirname, '../../public/views/error-template.html'),
+      inject: false,
+    }),
     new HtmlWebpackPlugin({
     new HtmlWebpackPlugin({
       filename: path.resolve(__dirname, '../../public/views/index.html'),
       filename: path.resolve(__dirname, '../../public/views/index.html'),
       template: path.resolve(__dirname, '../../public/views/index-template.html'),
       template: path.resolve(__dirname, '../../public/views/index-template.html'),
       inject: 'body',
       inject: 'body',
       chunks: ['vendor', 'app'],
       chunks: ['vendor', 'app'],
     }),
     }),
-    new HtmlWebpackPlugin({
-      filename: path.resolve(__dirname, '../../public/views/error.html'),
-      template: path.resolve(__dirname, '../../public/views/error-template.html'),
-      inject: false,
-    }),
     function () {
     function () {
       this.hooks.done.tap('Done', function (stats) {
       this.hooks.done.tap('Done', function (stats) {
         if (stats.compilation.errors && stats.compilation.errors.length) {
         if (stats.compilation.errors && stats.compilation.errors.length) {