willdurand / BazingaJsTranslationBundle

A pretty nice way to expose your Symfony translation messages to your client applications.
MIT License
572 stars 178 forks source link

Uncaught ReferenceError: Translator is not defined #318

Open dubitoph opened 3 years ago

dubitoph commented 3 years ago

Hello,

I'm using Symfony 5.1, webpack Encore 1.8 and bazinga-translator 4.0.1. I have this error :

Uncaught ReferenceError: Translator is not defined

Howerver, I import the module in the app.js like this :

import Translator from 'bazinga-translator';
window['Translator'] = Translator;

I don't understand this mistake.

GGarmy commented 2 years ago

Hello,

I had the same issue, but I soved it via :

const Translator = require('bazinga-translator');
global.Translator = window.Translator = Translator;