valterlorran/vuejs-localization

How to combine lang trees from submodules

Closed this issue ยท 2 comments

I have a submodule with common ui elements, and my app-level projects pull this in. It deserves its own lang folder, rather than propagating the lang changes for those ui elements in all the apps that use the submodule. This brings to mind usage such as:

Lang.requireAll(require.context(['a', 'b', 'c'], true, '\.js$')

but require-context doesn't support that. I tried forking require-context to support an array of directories, but this produces the warning:

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

I'm not sure how to handle it really.

Hellow,
Did you try something like this?

Lang.requireAll(require.context('a', true, /\.js$/));
Lang.requireAll(require.context('b', true, /\.js$/));
Lang.requireAll(require.context('c', true, /\.js$/));

Hi valterlorran -- no I hadn't! doh!