vue-i18n-extract icon indicating copy to clipboard operation
vue-i18n-extract copied to clipboard

Provide documentation on how to use as ES6 module

Open jplaverdure opened this issue 1 year ago • 4 comments

Hello,

I'm a bit of a newbie to the JS ecosystem and understand there are 2 module loading schemes (commonJS and ES6) It would be nice to have a bit more documentation on how to use this tool in the context of an ES6 project.

It seems everything I attempt results in:

[vue-i18n-extract] SyntaxError: Cannot use import statement outside a module
    at /u/jpl/Documents/binfo/qarome/node_modules/vue-i18n-extract/dist/vue-i18n-extract.umd.js:166:53
    at Array.map (<anonymous>)
    at readLanguageFiles (/u/jpl/Documents/binfo/qarome/node_modules/vue-i18n-extract/dist/vue-i18n-extract.umd.js:153:26)
    at Object.createI18NReport (/u/jpl/Documents/binfo/qarome/node_modules/vue-i18n-extract/dist/vue-i18n-extract.umd.js:291:29)
    at Object.<anonymous> (/u/jpl/Documents/binfo/qarome/test_extract.js:3:31)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

I see the presence of a vue-i18n-extract.modern.mjs file in the dist folder but how do I make use of it ? Surely I'm not the only one trying to figure out how to make this work..

All help is welcome !

jplaverdure avatar Mar 26 '24 14:03 jplaverdure

Forgot to mention, but I'm trying to use this on a Quasar project.. Maybe that explains the issues I'm running into ?

jplaverdure avatar Mar 26 '24 14:03 jplaverdure

@jplaverdure do you resolve this issue?

mreduar avatar May 14 '24 17:05 mreduar

I unfortunately resolved it by using the vue-gettext plugin which worked perfectly in my case.

jplaverdure avatar May 15 '24 16:05 jplaverdure

I solved it with this comment.

mreduar avatar May 15 '24 16:05 mreduar