Appearance
初始化开发环境
初始化配置安装rollup
bash
npm init -y
npm install rollup rollup-plugin-serve
1
2
2
javascript
import serve from 'rollup-plugin-serve'
export default {
input:'./src/single-spa.js',
output:{
file:'./lib/umd/single-spa.js',
format:"umd",
name:'singleSpa',
sourcemap:true
},
plugins:[
serve({
openPage:'/index.html',
contentBase:'',
port:3000
})
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
目录结构
bash
├── index.html # 网页目录
├── lib # 包
│ └── umd
│ └── single-spa.js # 生成的 sps 文件
├── package.json
├── rollup.config.js
└── src
└── start.js
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8