mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: optimize resource load
This commit is contained in:
1 parent
ba0beee9a8
commit
f1e4d896b9
3 files changed
+17
-6
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import * as redux from 'react-redux';
|
||||
|
||||
import './utils/delay';
|
||||
import './utils/emulateAnchorClick';
|
||||
@@ -24,6 +26,15 @@ import './components/notification';
|
||||
import './components/nprogress';
|
||||
import './components/monaco/loader';
|
||||
|
||||
window.node_modules = { _, $, React };
|
||||
const modules = {
|
||||
_, $, React, redux, ReactDOM,
|
||||
};
|
||||
export default async function load(name) {
|
||||
if (modules[name]) return modules[name];
|
||||
if (name === 'echarts') return import('echarts');
|
||||
if (name === 'moment') return import('moment');
|
||||
throw new Error(`Module ${name} not found`);
|
||||
}
|
||||
window.node_modules = { ...modules, load };
|
||||
window.$ = $;
|
||||
window.jQuery = $;
|
||||
Reference in new issue
Block a user