forked from troisjs/trois
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
109 lines (105 loc) · 2.54 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// import commonjs from '@rollup/plugin-commonjs';
import vue from 'rollup-plugin-vue';
import buble from '@rollup/plugin-buble';
import { terser } from "rollup-plugin-terser";
import replace from '@rollup/plugin-replace';
const input = 'src/export.js';
const external = [
'three',
'three/examples/jsm/controls/OrbitControls.js',
'three/examples/jsm/deprecated/Geometry.js',
'three/examples/jsm/lights/RectAreaLightUniformsLib.js',
'three/examples/jsm/helpers/RectAreaLightHelper.js',
'three/examples/jsm/loaders/GLTFLoader.js',
'three/examples/jsm/postprocessing/BokehPass.js',
'three/examples/jsm/postprocessing/EffectComposer.js',
'three/examples/jsm/postprocessing/FilmPass.js',
'three/examples/jsm/postprocessing/HalftonePass.js',
'three/examples/jsm/postprocessing/RenderPass.js',
'three/examples/jsm/postprocessing/Pass.js',
'three/examples/jsm/postprocessing/SAOPass.js',
'three/examples/jsm/postprocessing/SMAAPass.js',
'three/examples/jsm/postprocessing/ShaderPass.js',
'three/examples/jsm/postprocessing/UnrealBloomPass.js',
'three/examples/jsm/shaders/FXAAShader.js',
'vue',
];
const cdnReplaces = {
'from \'vue\'': 'from \'https://unpkg.com/[email protected]/dist/vue.esm-browser.prod.js\'',
'from \'three\'': 'from \'https://unpkg.com/[email protected]/build/three.module.js\'',
'from \'three/examples': 'from \'https://unpkg.com/[email protected]/examples',
delimiters: ['', ''],
};
const plugins = [
vue(),
buble({
transforms: { asyncAwait: false, forOf: false },
objectAssign: 'Object.assign',
}),
];
export default [
{
input,
external,
output: {
format: 'es',
exports: 'named',
file: 'build/trois.module.cdn.js',
sourcemap: true,
},
plugins: [
replace(cdnReplaces),
...plugins,
],
},
{
input,
external,
output: {
format: 'es',
exports: 'named',
file: 'build/trois.module.cdn.min.js',
sourcemap: true,
},
plugins: [
replace(cdnReplaces),
...plugins,
terser(),
],
},
{
input,
external,
output: {
format: 'es',
exports: 'named',
file: 'build/trois.module.js',
sourcemap: true,
},
plugins,
},
{
input,
external,
output: {
format: 'es',
exports: 'named',
file: 'build/trois.module.min.js',
sourcemap: true,
},
plugins: [
...plugins,
terser(),
],
},
{
input,
external,
output: {
format: 'cjs',
file: 'build/trois.js',
sourcemap: false,
},
plugins,
},
];