diff --git a/src/compiler/codegen/index.js b/src/compiler/codegen/index.js index c96b3a38511..754e7759b6d 100644 --- a/src/compiler/codegen/index.js +++ b/src/compiler/codegen/index.js @@ -45,7 +45,7 @@ export function generate ( options: CompilerOptions ): CodegenResult { const state = new CodegenState(options) - const code = ast ? genElement(ast, state) : '_c("div")' + const code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state) ) : '_c("div")' return { render: `with(this){return ${code}}`, staticRenderFns: state.staticRenderFns diff --git a/test/unit/features/component/component.spec.js b/test/unit/features/component/component.spec.js index 34c037a1e74..697a9dddbe7 100644 --- a/test/unit/features/component/component.spec.js +++ b/test/unit/features/component/component.spec.js @@ -426,4 +426,17 @@ describe('Component', () => { vm.$destroy() }).then(done) }) + + it('render vnode with ' + } + } + }).$mount() + expect(vm.$el.nodeName).toBe('#comment') + expect('Templates should only be responsible for mapping the state').toHaveBeenWarned() + }) })