@alicloud/console-os-loader

Console OS Loader

Usage no npm install needed!

<script type="module">
  import alicloudConsoleOsLoader from 'https://cdn.skypack.dev/@alicloud/console-os-loader';
</script>

README

Console OS Loader

An app bundle loader used by console os

TODO

  • load single bundle
  • script load error handler
  • recursive load
  • load with deps
  • combo load bundle

How to use

tnpm i @alicloud/console-os-loader
import { loadBundle } from '@alicloud/console-os-loader'

const vpc = await loadBundle({
  id: 'vpc',
  url: 'https://g.alicdn.com/aliyun-next/vpc/index.js'
})

External library

import react from 'react'
import { loadBundle } from '@alicloud/console-os-loader'

const vpc = await loadBundle(
  {
    id: 'vpc',
    url: 'https://g.alicdn.com/aliyun-next/vpc/index.js'
    deps: {
      react,
    }
  }
)

Build bundle

Webpack

in you webpack.config.js

const Chain = require('webpack-chain');
const merge = require('webpack-merge');
const { chainOsWebpack } = require('@alicloud/console-toolkit-plugin-os')

const chain = new Chain();
chainOsWebpack({ id: 'app-id' })(chain);
module.exports = merge(/*you webpack conf*/, chain.toConfig());

Consol OS Toolkit

In OS, an app bundle is built by breezr, you can use @alicloud/console-toolkit-plugin-os to build your bundle

/* breezr.config.js */

module.exports = {
  /*
   * other breezr config
   */
  plugins: [
    '@alicloud/console-toolkit-plugin-os'
  ]
}