Skip to content

annotate: Not sure where the SFC parse error occurred #36

Open
@kazupon

Description

@kazupon

Clear and concise description of the problem

Currently, when an error occurs in SFC parse, an error with the following stack trace is output:

SyntaxError: SFC parse error
    at Object.annotate (/path/to/ode_modules/@intlify/cli/lib/chunks/annotate.cjs:202:19)
    at Object.handler (/path/to/ode_modules/@intlify/cli/lib/cli.cjs:195:30) {
  erorrs: [
    SyntaxError: Element is missing end tag.
        at createCompilerError (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:19:19)
        at emitError (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1599:29)
        at parseElement (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1152:9)
        at parseChildren (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:943:28)
        at parseElement (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1131:22)
        at parseChildren (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:943:28)
        at parseElement (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1131:22)
        at parseChildren (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:943:28)
        at parseElement (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1131:22)
        at parseChildren (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:943:28) {
      code: 24,
      loc: [Object]
    }
  ],
  filepath: '/path/to/src/apps/custom_tag/CustomTagView.vue'
}

We don’t know the location that is occured .vue file.

Suggested solution

We should output the location as well, as shown below:

SyntaxError: SFC parse error
    at Object.annotate (/path/to/ode_modules/@intlify/cli/lib/chunks/annotate.cjs:202:19)
    at Object.handler (/path/to/ode_modules/@intlify/cli/lib/cli.cjs:195:30) {
  erorrs: [
    SyntaxError: Element is missing end tag.
      code: 24,
      loc: {
	line: 1,
	column: 1
      }
    }
  ],
  filepath: '/path/to/src/apps/custom_tag/CustomTagView.vue'
}

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions