Closed johannes-z closed 2 years ago
There is already an open pull request: #11
I have several Components in my project that use render functions, but are defined as .vue to allow using <style> tags. This plugin fails if no <template> is specified.
.vue
<style>
<template>
[vite] Internal server error: Cannot read properties of null (reading 'lang'
The error stems from this LOC: https://github.com/vitejs/vite-plugin-vue2/blob/e68672807359e36a5bec647dcf21a6b3b1580c70/src/main.ts#L182 (template is undefined).
template
This if should also check for an undefined template.
Repro: https://github.com/johannes-z/repro_vite-plugin-vue2-templates
<template> <div> <!-- dummy --> </div> </template> <script lang="ts"> import Vue, { h, defineComponent } from 'vue' export default defineComponent({ setup() { return () => h('div', 'Test') } }) </script>
<script lang="ts"> import Vue, { h, defineComponent } from 'vue' export default defineComponent({ setup() { return () => h('div', 'Test') } }) </script>
There is already an open pull request: #11
I have several Components in my project that use render functions, but are defined as
.vue
to allow using<style>
tags. This plugin fails if no<template>
is specified.The error stems from this LOC: https://github.com/vitejs/vite-plugin-vue2/blob/e68672807359e36a5bec647dcf21a6b3b1580c70/src/main.ts#L182 (
template
is undefined).This if should also check for an undefined
template
.Repro: https://github.com/johannes-z/repro_vite-plugin-vue2-templates
Works
Doesn't Work