mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 20:07:06 +08:00
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { join } from 'path'
|
|
import { RollupOptions } from 'rollup'
|
|
import nodeResolve from '@rollup/plugin-node-resolve'
|
|
import commonjs from '@rollup/plugin-commonjs'
|
|
import typescript from '@rollup/plugin-typescript'
|
|
import alias from '@rollup/plugin-alias'
|
|
import json from '@rollup/plugin-json'
|
|
import { builtins } from './utils'
|
|
|
|
export default (env = 'production') => {
|
|
const options: RollupOptions = {
|
|
input: join(__dirname, '../src/main/index.ts'),
|
|
output: {
|
|
file: join(__dirname, '../dist/main/index.js'),
|
|
format: 'cjs',
|
|
name: 'ElectronMainBundle',
|
|
sourcemap: true,
|
|
},
|
|
plugins: [
|
|
nodeResolve(),
|
|
commonjs(),
|
|
json(),
|
|
typescript({
|
|
module: 'ESNext',
|
|
}),
|
|
alias({
|
|
entries: [
|
|
{ find: '@render', replacement: join(__dirname, '../src/render') },
|
|
{ find: '@main', replacement: join(__dirname, '../src/main') },
|
|
{ find: '@src', replacement: join(__dirname, '../src') },
|
|
{ find: '@root', replacement: join(__dirname, '..') },
|
|
]
|
|
}),
|
|
],
|
|
external: [
|
|
...builtins(),
|
|
'electron',
|
|
],
|
|
}
|
|
|
|
return options
|
|
}
|