npm.io
0.4.0 • Published 4 years ago

babel-plugin-rdeco

Licence
MIT
Version
0.4.0
Deps
1
Size
6 kB
Vulns
0
Weekly
0
Stars
51

babel-plugin-rdeco

用于通过 import 自动载入 rdeco module 的 babel 插件

快速开始

// babel.config.js

module.exports = {
  plugins:[
    ['rdeco',{
      moduleMap:{
        'foo':'http://cdn.foo.js'
      }
    }]
  ]
}
```js

```js
// foo.js
import { create } fro '@rdeco/core'

create({
  name:'foo',
  exports:{
    name(){
      next('foo')
    }
  }
})
create({
  name:'hello',
  exports:{
    name(){
      next('hello')
    }
  }
})
// bar.js
import { foo, hello } from 'foo'
import rdeco from '@rdeco/web-app-sdk'

const res = await foo.name() // 'foo'import('http://cdn.foo.js')
import rdeco from '@rdeco/web-app-sdk'

const foo = rdeco.inject('foo')
const hello = rdeco.inject('hello')

const res = await foo.name() // 'foo'

Keywords