0.4.0 • Published 2 years ago

babel-plugin-rdeco v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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'
0.4.0

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago