-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.ts
46 lines (41 loc) · 1.14 KB
/
rollup.config.ts
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
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import nodeResolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import * as fs from 'fs';
import { defineConfig } from 'rollup';
import copy from 'rollup-plugin-copy';
const template = require('lodash.template');
import { version } from './package.json';
import { extractBanner } from './scripts/extractBannerPlugin';
const meta = template(fs.readFileSync(__dirname + '/src/meta.tpl.ts', 'utf8'));
const banner = meta({ version });
const globals = {
tagpro: 'tagpro',
three: 'THREE',
loglevel: 'log',
rgbquant: 'RgbQuant',
};
export default defineConfig([
{
input: 'src/index.ts',
output: {
file: 'docs/tagpro-3d.user.js',
format: 'iife',
banner,
globals,
interop: false, // NOTE: tries to load tagpro.default, if true
},
external: Object.keys(globals),
plugins: [
json(),
commonjs(),
nodeResolve(),
typescript(),
extractBanner({ file: 'docs/tagpro-3d.meta.js' }),
copy({
targets: [{ src: 'assets/', dest: 'docs/' }],
}),
],
},
]);