New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ucloud-fe/mod

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ucloud-fe/mod

A module loader support umd and own md

latest
Source
npmnpm
Version
1.2.1
Version published
Maintainers
3
Created
Source

MOD

npm version GitHub license GitHub tag Publish workflow Join the chat at https://gitter.im/ucloud-fe-mod/community

安装

npm install @ucloud-fe/mod

引用

import mod from '@ucloud-fe/mod';
// 导入 amd 支持
import amdResolver from '@ucloud-fe/mod/lib/resolver/amd';
// 注册模块类型解析器
mod.registerModuleResolver(amdResolver);

使用

// 添加模块配置
mod.config({
    modules: {
        react: {
            type: 'amd',
            js: 'https://cdn.jsdelivr.net/npm/react@16.13.1/umd/react.production.min.js'
        },
        'react-dom': {
            type: 'amd',
            js: 'https://cdn.jsdelivr.net/npm/react-dom@16.13.1/umd/react-dom.production.min.js',
            dep: 'react'
        }
    }
});

(async () => {
    // 加载模块
    const [React, ReactDOM] = await mod.import(['react', 'react-dom']);
    // 使用模块
    ReactDOM.render(React.createElement('button', {}, 'test'), document.getElementById('app'));
})();

使用教程

Keywords

ucloud-fe

FAQs

Package last updated on 15 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts