2021-01-30 18:15:47 +03:00
|
|
|
// rollup.config.js
|
2021-02-09 21:22:04 +03:00
|
|
|
import { terser } from 'rollup-plugin-terser'
|
|
|
|
import resolve from '@rollup/plugin-node-resolve'
|
|
|
|
import commonjs from '@rollup/plugin-commonjs'
|
|
|
|
import sucrase from '@rollup/plugin-sucrase'
|
|
|
|
import babel, { getBabelOutputPlugin } from '@rollup/plugin-babel'
|
|
|
|
import typescript from '@rollup/plugin-typescript'
|
|
|
|
import pkg from './package.json'
|
2021-01-30 18:15:47 +03:00
|
|
|
|
|
|
|
export default [
|
|
|
|
{
|
|
|
|
input: {
|
2021-02-09 21:22:04 +03:00
|
|
|
fs: './src/fs.ts',
|
|
|
|
path: './src/path.ts',
|
|
|
|
dialog: './src/dialog.ts',
|
|
|
|
event: './src/event.ts',
|
|
|
|
http: './src/http.ts',
|
|
|
|
index: './src/index.ts',
|
2021-02-12 08:42:40 +03:00
|
|
|
shell: './src/shell.ts',
|
2021-02-09 21:22:04 +03:00
|
|
|
tauri: './src/tauri.ts',
|
|
|
|
window: './src/window.ts',
|
|
|
|
cli: './src/cli.ts',
|
2021-02-14 23:34:23 +03:00
|
|
|
notification: './src/notification.ts',
|
|
|
|
globalShortcut: './src/globalShortcut.ts'
|
2021-01-30 18:15:47 +03:00
|
|
|
},
|
|
|
|
treeshake: true,
|
|
|
|
perf: true,
|
|
|
|
output: [
|
|
|
|
{
|
2021-02-09 21:22:04 +03:00
|
|
|
dir: 'dist/',
|
|
|
|
entryFileNames: '[name].js',
|
|
|
|
format: 'cjs',
|
|
|
|
exports: 'named',
|
|
|
|
globals: {}
|
2021-01-30 18:15:47 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-09 21:22:04 +03:00
|
|
|
dir: 'dist/',
|
|
|
|
entryFileNames: '[name].mjs',
|
|
|
|
format: 'esm',
|
|
|
|
exports: 'named',
|
|
|
|
globals: {}
|
|
|
|
}
|
2021-01-30 18:15:47 +03:00
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
commonjs({}),
|
|
|
|
resolve({
|
|
|
|
// pass custom options to the resolve plugin
|
|
|
|
customResolveOptions: {
|
2021-03-25 01:21:03 +03:00
|
|
|
moduleDirectories: ['node_modules']
|
2021-02-09 21:22:04 +03:00
|
|
|
}
|
2021-01-30 18:15:47 +03:00
|
|
|
}),
|
|
|
|
typescript({
|
2021-02-09 21:22:04 +03:00
|
|
|
tsconfig: './tsconfig.json'
|
2021-01-30 18:15:47 +03:00
|
|
|
}),
|
|
|
|
babel({
|
|
|
|
configFile: false,
|
2021-02-09 21:22:04 +03:00
|
|
|
presets: [['@babel/preset-env'], ['@babel/preset-typescript']]
|
2021-01-30 18:15:47 +03:00
|
|
|
}),
|
2021-02-09 21:22:04 +03:00
|
|
|
terser()
|
2021-01-30 18:15:47 +03:00
|
|
|
],
|
|
|
|
external: [
|
|
|
|
...Object.keys(pkg.dependencies || {}),
|
2021-02-09 21:22:04 +03:00
|
|
|
...Object.keys(pkg.peerDependencies || {})
|
2021-02-11 08:33:18 +03:00
|
|
|
]
|
2021-01-30 18:15:47 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
input: {
|
2021-02-09 21:22:04 +03:00
|
|
|
bundle: './src/bundle.ts'
|
2021-01-30 18:15:47 +03:00
|
|
|
},
|
|
|
|
output: [
|
|
|
|
{
|
2021-02-09 21:22:04 +03:00
|
|
|
name: '__TAURI__',
|
2021-03-23 06:03:07 +03:00
|
|
|
dir: '../tauri/scripts',
|
|
|
|
entryFileNames: 'bundle.js',
|
2021-02-09 21:22:04 +03:00
|
|
|
format: 'umd',
|
2021-01-30 18:15:47 +03:00
|
|
|
plugins: [
|
|
|
|
getBabelOutputPlugin({
|
2021-02-09 21:22:04 +03:00
|
|
|
presets: [['@babel/preset-env', { modules: 'umd' }]],
|
|
|
|
allowAllFormats: true
|
2021-01-30 18:15:47 +03:00
|
|
|
}),
|
2021-02-09 21:22:04 +03:00
|
|
|
terser()
|
2021-01-30 18:15:47 +03:00
|
|
|
],
|
2021-02-09 21:22:04 +03:00
|
|
|
globals: {}
|
|
|
|
}
|
2021-01-30 18:15:47 +03:00
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
sucrase({
|
2021-02-09 21:22:04 +03:00
|
|
|
exclude: ['node_modules'],
|
|
|
|
transforms: ['typescript']
|
2021-01-30 18:15:47 +03:00
|
|
|
}),
|
|
|
|
resolve({
|
|
|
|
// pass custom options to the resolve plugin
|
|
|
|
customResolveOptions: {
|
2021-03-25 01:21:03 +03:00
|
|
|
moduleDirectories: ['node_modules']
|
2021-02-09 21:22:04 +03:00
|
|
|
}
|
|
|
|
})
|
2021-01-30 18:15:47 +03:00
|
|
|
],
|
|
|
|
external: [
|
|
|
|
...Object.keys(pkg.dependencies || {}),
|
2021-02-09 21:22:04 +03:00
|
|
|
...Object.keys(pkg.peerDependencies || {})
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|