-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathrollup.config.js
50 lines (48 loc) · 1.44 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
47
48
49
50
// import fs from 'fs-extra';
import path from 'path';
import copy from 'rollup-plugin-copy';
import json from '@rollup/plugin-json';
import esbuild from 'rollup-plugin-esbuild';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import nodePolyfills from 'rollup-plugin-polyfill-node';
const pkg = 'google-translate.bobplugin';
export default {
input: path.join(__dirname, './src/main.ts'),
output: {
format: 'cjs',
exports: 'auto',
file: path.join(__dirname, `./dist/${pkg}/main.js`),
},
plugins: [
copy({
targets: [
{ src: './src/info.json', dest: `dist/${pkg}/` },
{ src: './src/libs', dest: `dist/${pkg}/` },
],
}),
json({ namedExports: false }),
resolve({
extensions: ['.js', '.ts'],
modulesOnly: true,
preferBuiltins: false,
}),
commonjs(),
nodePolyfills(),
esbuild({
// All options are optional
include: /\.[jt]?s$/, // default, inferred from `loaders` option
exclude: /node_modules/, // default
sourceMap: false, // default
minify: process.env.NODE_ENV === 'production',
target: 'es6', // default, or 'es20XX', 'esnext',
// Add extra loaders
loaders: {
// Add .json files support
// require @rollup/plugin-commonjs
'.json': 'json',
},
}),
],
external: ['crypto-js', '$util', '$http', '$info', '$option', '$log', '$data', '$file'],
};