Babel Plugin Quick Quote
babel plugin quickly introduce the echarts module on demand
const echarts = test = 'test';// transform:// import echarts from "echarts/lib/echarts";// import "echarts/lib/chart/line";// import "echarts/lib/chart/bar";// const test = 'test';
// If there is no corresponding configuration in the configuration file quick-quote.config.js,// output will be as it is.const echarts = // transform:// import echarts from "echarts/lib/echarts";// import "path/demo/path";// import "echarts/lib/chart/line";// import "echarts/lib/chart/bar";
// transform:// import "echarts/lib/echarts";// import "echarts/lib/chart/line";// import "echarts/lib/chart/bar";
const initEcharts = // transform:// let $_QuickQuote_echartsInstance = null;// function initEcharts() {// if (!$_QuickQuote_echartsInstance) {// $_QuickQuote_echartsInstance =// import( /* webpackChunkName: \\"echarts\\" */ 'echarts/lib/echarts').// then(echarts => {// return Promise.all([echarts,// import( /* webpackChunkName: \\"echarts\\" */ 'echarts/lib/chart/line'),// import(/* webpackChunkName: \\"echarts\\" */'echarts/lib/chart/bar')]).// then(([echarts]) => echarts);// });// }// return $_QuickQuote_echartsInstance;// }
//If there is no variable name, it will default to// function getEchartsInstance()// transform:// let $_QuickQuote_echartsInstance = null;// function getEchartsInstance() {// if (!$_QuickQuote_echartsInstance) {// $_QuickQuote_echartsInstance =// import( /* webpackChunkName: \\"echarts\\" */ 'echarts/lib/echarts').// then(echarts => {// return Promise.all([echarts,// import( /* webpackChunkName: \\"echarts\\" */ 'echarts/lib/chart/line'),// import(/* webpackChunkName: \\"echarts\\" */'echarts/lib/chart/bar')]).// then(([echarts]) => echarts);// });// }// return $_QuickQuote_echartsInstance;// }
Usage
//.babelrc "plugins": // 'babal-plugin-quick-quote' "quick-quote"
//babel.config.jsmoduleexports = plugins: // 'babal-plugin-quick-quote' 'quick-quote'
use the babel-plugin-quick-quote command, generate the corresponding configuration file(quick-quote.config.js) for the echarts version currently used by the project.
babal-plugin-quick-quote