Skip to content

template src reference not supported #6

@StarHosea

Description

@StarHosea

Describe the bug

A.vue

<template src="./B.vue">
</template>
<script>
export default {
  
}
</script>

B.vue

<template>
   <div>This is real template </div>
</template>

When Vite build the A.vue in library mod , A Component's render compile result like this

function render(_ctx, _cache, $props, $setup, $data, $options) {
  return openBlock(), createElementBlock("template", null, _hoisted_2);
}

That will create a template tag in html. By the way, vue-cli service build works properly

Reproduction

the repo is
https://github.com/StarHosea/vite-template-build-issue.git

System Info

System:
    OS: Windows 10 10.0.19043
    CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
    Memory: 4.43 GB / 15.85 GB
  Binaries:
    Node: 12.18.4 - E:\DevEnv\nodejs\node.EXE
    Yarn: 1.17.3 - D:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.6 - E:\DevEnv\nodejs\npm.CMD
  Browsers:
    Chrome: 93.0.4577.82
    Edge: Spartan (44.19041.1023.0), Chromium (94.0.992.31)
    Internet Explorer: 11.0.19041.1202

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions