undefinedfix
Sign in

In Vue single file component, if you just write an empty script tag, the development environment will not report an error, but it will report an error once packaged

F4r5h4d edited in Wed, 08 Jun 2022
<template>
    <div>
        <p>你好啊</p>
    </div>
</template>

<script>
    
</script>

As a simple component, the above code can be referenced in other components. The development environment will not report an error when compiling, but it will report 'cannot set property render of undefined' once packaged. If you do not write this script, the empty tag will not report an error, or it will write export default {}, Why? Considering that the components are not exposed, why does the development environment not report errors and ask for the guidance of the great God

2 Replies
Joe
commented on Thu, 09 Jun 2022

This is a Vue loader bug

user282
commented on Thu, 09 Jun 2022

In the same way, the empty script tag will cause the options object generated by Vue loader to be empty when parsing the component, resulting in render function unable to render

lock This question has been locked and the reply function has been disabled.