From f5530ad6536c38a55e8475f596bd7fd7b5c3471d Mon Sep 17 00:00:00 2001 From: Kenta Suzuki Date: Sun, 21 Oct 2018 04:47:47 +0900 Subject: [PATCH] fix(app): throw an error when layout property is not string (#4142) --- packages/app/template/App.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/app/template/App.js b/packages/app/template/App.js index 786d710afb..be50ecb55d 100644 --- a/packages/app/template/App.js +++ b/packages/app/template/App.js @@ -83,6 +83,9 @@ export default { <% } %> <% if (splitChunks.layouts) { %> setLayout (layout) { + <% if (debug) { %> + if(layout && typeof layout !== 'string') throw new Error('[nuxt] Avoid using non-string value as layout property.') + <% } %> if (!layout || !resolvedLayouts['_' + layout]) layout = 'default' this.layoutName = layout let _layout = '_' + layout @@ -110,6 +113,9 @@ export default { } <% } else { %> setLayout(layout) { + <% if (debug) { %> + if(layout && typeof layout !== 'string') throw new Error('[nuxt] Avoid using non-string value as layout property.') + <% } %> if (!layout || !layouts['_' + layout]) { layout = 'default' }