-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
84 lines (78 loc) · 1.71 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import postcss from "rollup-plugin-postcss";
import babel from "rollup-plugin-babel";
import metablock from "rollup-plugin-userscript-metablock";
import ts from "rollup-plugin-typescript2";
import path from "path";
const url = require('postcss-url');
const config = {
postcss: {
minimize: true,
extensions: [".css"],
inject: false,
plugins: [
url({
url: "inline",
maxSize: 50,
fallback: "copy",
}),
],
},
babel: {
exclude: ["node_modules/**"],
presets: [
[
"@babel/env",
{
modules: false,
targets: "last 2 versions, ie > 10",
},
],
],
},
};
const metas = {
brlbBlocker: {
input: "./meta/blank.js",
output: {
file: "./dist/brlbBlocker.meta.js",
format: "es",
name: "copyMetaModule",
},
plugins: [
metablock({
file: "./src/meta.json",
}),
],
},
};
const scriptCatMetas =`/* ==UserConfig==
blockList:
uid:
title: uid黑名单
description: uid黑名单,注意若格式填写有问题则会影响脚本运行!格式为 ["xxx", "xxx"]
default: s[]
==/UserConfig== */`;
const scripts = {
brlbBlocker: {
input: "./src/index.js",
output: {
file: "./dist/brlbBlocker.user.js",
format: "iife",
name: "copyModule",
banner: scriptCatMetas,
},
plugins: [
postcss(config.postcss),
babel(config.babel),
// ts({
// tsconfig: path.resolve(__dirname, "./tsconfig.json"),
// extensions: [".ts"],
// }),
// uglify(),
metablock({
file: "./src/meta.json",
}),
],
},
};
export default [...Object.values(metas), ...Object.values(scripts)];