2021-04-11 01:09:09 +03:00
|
|
|
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
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-04-08 18:50:55 +03:00
|
|
|
app: './src/app.ts',
|
2021-02-09 21:22:04 +03:00
|
|
|
fs: './src/fs.ts',
|
|
|
|
path: './src/path.ts',
|
|
|
|
dialog: './src/dialog.ts',
|
|
|
|
event: './src/event.ts',
|
2021-04-05 20:51:17 +03:00
|
|
|
updater: './src/updater.ts',
|
2021-02-09 21:22:04 +03:00
|
|
|
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/',
|
2021-04-22 21:39:59 +03:00
|
|
|
entryFileNames: '[name].cjs',
|
2021-04-19 06:31:12 +03:00
|
|
|
format: 'cjs',
|
2021-04-26 20:12:00 +03:00
|
|
|
chunkFileNames: '[name]-[hash].cjs',
|
2021-04-19 06:31:12 +03:00
|
|
|
exports: 'named',
|
|
|
|
globals: {}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
dir: 'dist/',
|
2021-04-22 21:39:59 +03:00
|
|
|
entryFileNames: '[name].js',
|
2021-02-09 21:22:04 +03:00
|
|
|
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-04-12 07:59:25 +03:00
|
|
|
dir: '../../core/tauri/scripts',
|
2021-03-23 06:03:07 +03:00
|
|
|
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 || {})
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|