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

[vue-i18n-extract] SyntaxError: Unexpected token 'export' #214

Open
Compizfox opened this issue Dec 26, 2023 · 0 comments
Open

[vue-i18n-extract] SyntaxError: Unexpected token 'export' #214

Compizfox opened this issue Dec 26, 2023 · 0 comments

Comments

@Compizfox
Copy link

I'm trying to use vue-i18n-extract and vue-i18n v9 for Vue 3, but get the following error when trying to run it:

npm run vue-i18n-extract

> huispage@0.0.1 vue-i18n-extract
> vue-i18n-extract report --vueFiles './src/**/*.?(js|vue|ts)' --languageFiles './src/i18n/*.?(ts|js|mjs)'

[vue-i18n-extract] SyntaxError: Unexpected token 'export'
    at /home/lars/src/Huispage/frontend/node_modules/vue-i18n-extract/dist/vue-i18n-extract.umd.js:199:47
    at Array.map (<anonymous>)
    at readLanguageFiles (/home/lars/src/Huispage/frontend/node_modules/vue-i18n-extract/dist/vue-i18n-extract.umd.js:187:24)
    at createI18NReport (/home/lars/src/Huispage/frontend/node_modules/vue-i18n-extract/dist/vue-i18n-extract.umd.js:339:27)
    at CAC.<anonymous> (/home/lars/src/Huispage/frontend/node_modules/vue-i18n-extract/bin/vue-i18n-extract.js:47:5)
    at CAC.runMatchedCommand (/home/lars/src/Huispage/frontend/node_modules/cac/dist/index.js:614:34)
    at CAC.parse (/home/lars/src/Huispage/frontend/node_modules/cac/dist/index.js:541:12)
    at Object.<anonymous> (/home/lars/src/Huispage/frontend/node_modules/vue-i18n-extract/bin/vue-i18n-extract.js:56:5)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)

In installed it as explained in the README, with the following in package.json:

  "scripts": {
    "vue-i18n-extract": "vue-i18n-extract report --vueFiles './src/**/*.?(js|vue|ts)' --languageFiles './src/i18n/*.?(ts|js)'"
  }

My locale message file looks like this:

export default {
	'en': {
		'key': 'Message',
        },
}

Does vue-i18n-extract not support vue-i18n v9 for Vue 3 or am I doing something wrong? I found some old threads describing the same issue (I think) but it's not clear to me how to fix it.

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

No branches or pull requests

1 participant