xiCO2k / laravel-vue-i18n

Allows to connect your `Laravel` Framework translation files with `Vue`.
MIT License
619 stars 51 forks source link

Cannot load language files #15

Closed davidtovt closed 2 years ago

davidtovt commented 2 years ago

Hello,

Why I get the following error?

GET http://***.com/js/resources_lang_hu_json.js net::ERR_ABORTED 404 (Not Found)
Uncaught (in promise) TypeError: Cannot load lang: hu file: Loading chunk resources_lang_hu_json failed.

The resources/lang/en.json file exists.

xiCO2k commented 2 years ago

Hey @davidtovt are you using webpack?

Also can you share the code where you import the code?

davidtovt commented 2 years ago

@xiCO2k Yes, I use Webpack.

I share my code: https://i.imgur.com/VwjrjHr.png

And there is an error in node_modules/laravel-vue-i18n/tsconfig.json https://i.imgur.com/ptbhdeu.png

xiCO2k commented 2 years ago

THanks @davidtovt

try this:

resolve: (lang) => import(`../lang/{lang}.json`),

it will tell webpack to take a look on the lang folder and chunk every lang file.

davidtovt commented 2 years ago

@xiCO2k then I get the same error, just with en_json:

GET http://***.com/js/resources_lang_en_json.js net::ERR_ABORTED 404 (Not Found)
Uncaught (in promise) TypeError: Cannot load lang: en file: Loading chunk resources_lang_en_json failed.
xiCO2k commented 2 years ago

Weird case, try this since I miss the $ sign

resolve: (lang) => import(`../lang/${lang}.json`),
davidtovt commented 2 years ago

It is not working.

In laravel-vue-i18n/src/index.ts there is a line which not used anywhere: import { LanguageJsonFileInterface } from './interfaces/language-json-file' It is not problem?

xiCO2k commented 2 years ago

Should not be related, one thing can you check if the path is correct to your language files?