lazy loading mutiple contexts in webpack -
i want load 2 modules 2 different contexts (possibly in single chunk) after i've read navigator.language, suppose have lazy load, working:
var loaddata = require('bundle?lazy&name=intl!react-intl/locale-data/' + navigator.language + '.js'); var loadtranslation = require('bundle?lazy&name=intl!translantion/' + navigator.language + '.js'); loaddata (function (a) { loadtranslation (function (b) { console.log('i can\'t believe have wait ', a, b); } });
but hoping better syntax, have tried require.ensure, , with
require(['bundle?lazy!react-intl/locale-data/' + navigator.language + '.js','bundle?lazy!translantion/' + navigator.language + '.js'], function (a, b) { console.log('what doing wrong?'); });
but either "require function used in way in dependencies cannot statically extracted", or messages not there yet when render, idea?
Comments
Post a Comment