-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathrollup.config.js
46 lines (41 loc) · 1.33 KB
/
rollup.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
43
44
45
46
const typescript2 = require('rollup-plugin-typescript2')
const { spawn } = require('child_process')
// import { nodeResolve } from '@rollup/plugin-node-resolve'
// const json = require("@rollup/plugin-json");
let httpAddress = `http://localhost:1234`
const defaultConfig = {
input: ['./electron/main.ts', './electron/preload.ts'],
output: {
dir: './dist-electron', // 输出目录
format: 'cjs', // 输出格式, 可选值: amd, cjs, es, iife, umd
sourcemap: true, // 是否生成sourcemap, 默认为false
// globals, // 外部依赖,
},
plugins: [
// 使用typescript2插件
typescript2(),
// 解析node_modules中的模块
// nodeResolve({ preferBuiltins: false }), // or `true`
// 解析json文件
// json(),
// 打包结束后执行的钩子函数
// {
// buildEnd: (error) => {
// if (error) {
// console.log(error)
// } else {
// console.log('打包成功')
// let electronProcess = spawn(require('electron').toString(), ['./dist-electron/main.js', httpAddress], {
// cwd: process.cwd(),
// stdio: 'inherit',
// })
// electronProcess.on('close', () => {
// server.close()
// process.exit()
// })
// }
// },
// },
],
}
module.exports = defaultConfig