Javascript module import command demo in ES6

in ES 6, Javascript module import in two ways, the dynamic import and the hardcode import

 

{ Hardcode Import }

import VueI18n from 'vue-i18n'

the file name/module name is hardcode no change need.

 

 { Dynamic Import }

import(/* webpackChunkName: "lang-[request]" */'yiilib.com/i18n/lang/'+store.state.account.locale)
.then(loadContent => {
  tmpMsg[store.state.account.locale] = loadContent.default
});

 the file name/module name is dynamic can be changed with any verb. also support lazy loading...