intlify / cli

CLI Tooling for i18n development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

annotate: Not sure where the SFC parse error occurred

kazupon opened this issue · comments

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