xiCO2k / laravel-vue-i18n

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

TypeError: laravel_vue_i18n__WEBPACK_IMPORTED_MODULE_22__.I18n is undefined #142

Closed flespindola closed 10 months ago

flespindola commented 1 year ago

I just got this issue when I try to get the shared instance in my script setup

Uncaught (in promise) TypeError: laravel_vue_i18n__WEBPACK_IMPORTED_MODULE_22__.I18n is undefined

import { I18n } from 'laravel-vue-i18n'

I18n.getSharedInstance()

webpack:

const mix = require('laravel-mix');

require('laravel-mix-eslint')

const webpackConfig = require('./webpack.config');

require('laravel-vue-i18n/mix')

mix.js('resources/js/app.js', 'public/js')
    .extract() 
    .vue()
    .eslint({
        fix: true,
        extensions: ['vue', 'js']
      })
    .i18n()
    .postCss('resources/css/app.css', 'public/css', [
        require('postcss-import'),
    ])
    .sass('resources/js/Layouts/App.scss', 'public/css/app.css')
    .version()

    .webpackConfig(webpackConfig)
/*    .alias({
        '@': 'resources/js',
    });*/

if (mix.inProduction()) {
    mix.version();
}

My package.json doesn't have "type":"module" Node version: v20.3.0 Npm version: 9.6.7 Laravel 10

daniser commented 1 year ago

Just noticed you have some mess with the quotes:

import { I18n } from 'laravel-vue-i18n

I18n.getSharedInstance()`

Does it actually look like this in your code?

flespindola commented 1 year ago

I'm sorry, my mistake. Just fix the comment. This quotes doesn't exists in code

xiCO2k commented 1 year ago

Its possible for you, to have a public repo with that exact error?

Thanks

flespindola commented 1 year ago

Yes, I did it a repo so you can see the error by cloning

https://github.com/flespindola/soapp-test

xiCO2k commented 1 year ago

Thats great thanks!

ricardobrunosr commented 1 year ago

Hello, is there any solution for this problem?

xiCO2k commented 1 year ago

Sorry not yet able to debug the issue.

xiCO2k commented 1 year ago

@flespindola I did clone the repo, but I'm not getting that error, any ideias?