videojs / videojs-errors

A video.js plugin that displays error messages to video viewers.
Other
87 stars 29 forks source link

es6 import of a language file does not work #115

Closed axten closed 3 years ago

axten commented 6 years ago

Description

if I try to import a language file I got ReferenceError: videojs is not defined

so any lang file should have an import statement befor videojs to fix this. besides that, a work around could be to provide the pure json files in videojs build. this also would be great to extend a language during project build.

Steps to reproduce

just do

import videojs from 'video.js';
import 'videojs-errors';

import 'videojs-errors/dist/lang/de';

Results

Expected

should work as expected

Actual

it breaks

Additional Information

videojs: 6.8.0

brandonocasey commented 6 years ago

You could do:


...
import deLang from `videojs-errors/lang/de.json`;

videojs.addLanguage('de', deLang);
...
axten commented 6 years ago

no, the lang folder is not included in dist package.

gkatsev commented 3 years ago

lang folder is now included in the dist folder. Both a .js and a .json file are available there.