-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
42 lines (40 loc) · 1.09 KB
/
Copy pathrollup.config.js
File metadata and controls
42 lines (40 loc) · 1.09 KB
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
const fs = require('fs');
const path = require('path');
const copy = require('rollup-plugin-copy');
const commonjs = require('@rollup/plugin-commonjs');
const resolve = require('@rollup/plugin-node-resolve');
const packageJson = require('./package.json');
const pkg = `${packageJson.name}.bobplugin`;
const noticeText = ['LICENSE', 'THIRD_PARTY_NOTICES.md']
.map((file) => fs.readFileSync(path.join(__dirname, file), 'utf8').trim())
.join('\n\n');
const noticeBanner = `/*!\n${noticeText
.replaceAll('*/', '* /')
.split('\n')
.map((line) => ` * ${line}`)
.join('\n')}\n */`;
module.exports = {
input: path.join(__dirname, './src/main.js'),
output: {
format: 'cjs',
exports: 'auto',
banner: noticeBanner,
file: path.join(__dirname, `./dist/${pkg}/main.js`),
globals: {
$util: '$util',
$info: '$info',
$log: '$log',
},
},
plugins: [
copy({
targets: [{ src: './src/info.json', dest: `dist/${pkg}/` }],
}),
resolve({
extensions: ['.js', '.json'],
preferBuiltins: false,
}),
commonjs(),
],
external: ['crypto-js'],
};