@ali-i18n-fe/intl-require-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

intl-require-js

Using TypeScript

基于 RequireJS 封装的,适合业务使用的异步模块加载器

  • 支持加载 AMD 规范模块
  • 支持阿里 CDN Combo 模块
  • 支持 CSS 加载
  • 支持 JSON 加载
  • 根据 Url 自动适配加载
  • Promise 规范

Usage

import RequireJS from '@alife/intl-require-js';

const moduleUrls = {
  js: 'https://g.alicdn.com/code/npm/@alife/intl-comp-cms-one-step-banner/1.0.15/index.js',
  css: 'https://g.alicdn.com/code/npm/@alife/intl-comp-cms-one-step-banner/1.0.15/index.css',
  json: 'https://g.alicdn.com/code/npm/@alife/intl-comp-cms-one-step-banner/1.0.15/typeFile.json',
};

const module = await RequireJS.loadScript(moduleUrls.js);
await RequireJS.loadCss(moduleUrls.css);
const json = await RequireJS.loadJson(moduleUrls.json);

// or just use like this


const module = await RequireJS.load(moduleUrls.js);
await RequireJS.load(moduleUrls.css);
const json = await RequireJS.load(moduleUrls.json);

Development

install

yarn

start project

yarn start

build npm package

yarn babel

build umd package

yarn build

Readme

Keywords

none

Package Sidebar

Install

npm i @ali-i18n-fe/intl-require-js

Weekly Downloads

2

Version

1.0.13

License

none

Unpacked Size

146 kB

Total Files

41

Last publish

Collaborators

  • international_fe_alibaba