-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.mjs
40 lines (36 loc) · 891 Bytes
/
rollup.config.mjs
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
import fs from 'node:fs';
import process from 'node:process';
import vue from 'rollup-plugin-vue';
import postcss from 'rollup-plugin-postcss';
import commonjs from '@rollup/plugin-commonjs';
import metablock from 'rollup-plugin-userscript-metablock';
// prevent absolute path in script
process.env.NODE_ENV = 'production';
const pkg = JSON.parse(fs.readFileSync('package.json'));
const external = ['vue', 'vue-router', 'js-yaml', 'lz-string'];
const globals = {
'vue': 'Vue',
'vue-router': 'VueRouter',
'js-yaml': 'jsyaml',
'lz-string': 'LZString',
};
export default {
input: 'src/index.js',
external,
plugins: [
vue(),
postcss(),
commonjs(),
metablock({
file: 'src/metablock.yml',
override: {
version: pkg.version,
},
}),
],
output: {
file: 'dist/dmhy-bangumi-index.user.js',
format: 'iife',
globals,
},
};