-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrollup.example.config.js
42 lines (39 loc) · 1.1 KB
/
rollup.example.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import path from 'path'
import htmlTemplate from 'rollup-plugin-generate-html-template'
import serve from 'rollup-plugin-serve'
import copy from 'rollup-plugin-copy'
import del from 'rollup-plugin-delete'
import { createRollupConfig } from './build/create-rollup-config'
// 继续生成 rollup config
const name = 'WangEditorForReact'
const input = path.resolve(__dirname, './example', 'index.tsx')
const file = 'dist-example/index.js'
const port = 8882
const config = createRollupConfig({
input,
output: {
file,
format: 'umd',
name,
},
plugins: [
serve({
// open: true,
contentBase: ['dist-example'],
port,
onListening: function () {
console.log(`Example is running on http://localhost:${port}/`)
},
}),
htmlTemplate({
template: 'example/index.html',
target: 'dist-example/index.html',
}),
del({ targets: 'dist-example/*' }),
copy({
// 将 packages/editor/dist 拷贝到 dist-example
targets: [{ src: './node_modules/@wangeditor/editor/dist/*', dest: 'dist-example/editor-dist' }],
}),
],
})
export default config