Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple root nodes throwing RangeError instead of Component template should contain exactly one root element #1491

Closed
tyteen4a03 opened this issue Feb 7, 2019 · 3 comments

Comments

@tyteen4a03
Copy link

tyteen4a03 commented Feb 7, 2019

Version

15.6.0

Reproduction link

<template>
    <div>
        <section id="section-HelloWorld">
            <h2>Hello World!</h2>
        </section>
    </div>
    <div></div>
    <div></div>
</template>

Steps to reproduce

Compile the codesandbox with webpack and vue-loader (don't know how to get webpack to work online - sorry!).

What is expected?

Error should be: Cannot use as component root element because it may contain multiple nodes.

What is actually happening?

Actual error thrown: RangeError: Invalid string length

@Flyingmana
Copy link

can second this.
template code to replicate the error:

<template>
    <div>
        <section id="section-HelloWorld">
            <h2>Hello World!</h2>
        </section>
    </div>
    <div></div>
    <div></div>
</template>

@tyteen4a03
Copy link
Author

It looks like even forgetting to close a string literal in a v-bind will also trigger this error.

@posva posva changed the title Nested conditional <template> in single file component throws RangeError Multiple root nodes throwing RangeError instead of Component template should contain exactly one root element Feb 14, 2019
Flyingmana added a commit to Flyingmana/vue-loader that referenced this issue Mar 10, 2019
"Multiple root nodes throwing RangeError instead of Component template
should contain exactly one root element"
Flyingmana added a commit to Flyingmana/vue-loader that referenced this issue Mar 10, 2019
"Multiple root nodes throwing RangeError instead of Component template
should contain exactly one root element"
@yyx990803
Copy link
Member

This should have been fixed by an update to the error range function (confirmed via tests from #1510)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants