Skip to content

vue-template-compiler line number #8665

Closed
@fleksin

Description

@fleksin

What problem does this feature solve?

Recently I am trying to write a webpack loader for vue component, during which I came across the package vue-template-compiler.
It works perfectly except that it doesn't have any location info in the ast.

I read something here:

http://echizen.github.io/tech/2017/10-29-vue2wx

It's in Chinese, but you can see the ast result from the compiler method has "originLine" to indicate position.
But When I tried it I didn't get the "originLine", link:

https://runkit.com/fleksin/5b754fd8f424830012365766

So I am not sure if it's already a feature or is it removed from 2.5.17, or am I missing something in the options ?
btw, the version of vue-template-compiler I'm using is 2.5.17.
Some general direction would be much apprieciated.
Thanks in advance :)

What does the proposed API look like?

return ast like this:

{
   ast:   {
      ...
     originLine: xx,
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions