1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00
trois/rollup.config.js

150 lines
3.3 KiB
JavaScript
Raw Permalink Normal View History

2020-09-16 21:30:39 +08:00
import commonjs from '@rollup/plugin-commonjs';
import vue from 'rollup-plugin-vue';
import buble from '@rollup/plugin-buble';
import { terser } from "rollup-plugin-terser";
2020-10-04 06:49:05 +08:00
// import replace from '@rollup/plugin-replace';
2020-09-16 21:30:39 +08:00
2020-10-04 06:49:05 +08:00
const input = 'src/export.js';
2020-09-17 05:54:14 +08:00
const external = [
'three',
'three/examples/jsm/controls/OrbitControls.js',
2020-10-04 06:49:05 +08:00
'three/examples/jsm/loaders/GLTFLoader.js',
2020-09-17 05:54:14 +08:00
'three/examples/jsm/postprocessing/BokehPass.js',
2020-10-04 06:49:05 +08:00
'three/examples/jsm/postprocessing/EffectComposer.js',
'three/examples/jsm/postprocessing/FilmPass.js',
'three/examples/jsm/postprocessing/HalftonePass.js',
2020-09-17 05:54:14 +08:00
'three/examples/jsm/postprocessing/RenderPass.js',
2020-10-04 06:49:05 +08:00
'three/examples/jsm/postprocessing/SAOPass.js',
2020-09-17 05:54:14 +08:00
'three/examples/jsm/postprocessing/UnrealBloomPass.js',
2020-10-04 06:49:05 +08:00
'gsap',
2020-09-17 05:54:14 +08:00
'vue',
];
2020-10-04 06:49:05 +08:00
2020-09-16 21:30:39 +08:00
const plugins = [
commonjs(),
vue(),
buble({
2020-09-17 16:57:13 +08:00
// transforms: { forOf: false },
objectAssign: 'Object.assign',
2020-09-16 21:30:39 +08:00
}),
];
export default [
2020-10-04 06:49:05 +08:00
// {
// input,
// external,
// output: {
// format: 'umd',
// name: 'TroisJS',
// file: 'build/trois.umd.js',
// sourcemap: true,
// globals: {
// 'three': 'THREE',
// 'vue': 'Vue',
// },
// },
// plugins,
// },
// {
// input,
// external,
// output: {
// format: 'umd',
// name: 'TroisJS',
// file: 'build/trois.umd.min.js',
// sourcemap: true,
// },
// plugins: [
// ...plugins,
// terser(),
// ],
// },
// {
// input,
// external,
// output: {
// format: 'es',
// exports: 'named',
// file: 'build/trois.module.cdn.js',
// sourcemap: true,
// },
// plugins: [
// replace({
// 'from \'three\'': 'from \'https://unpkg.com/three@0.120.1/build/three.module.js\'',
// 'from \'three/examples': 'from \'https://unpkg.com/three@0.120.1/examples',
// 'from \'gsap\'': 'from \'https://unpkg.com/gsap@3.5.1/index.js\'',
// delimiters: ['', ''],
// }),
// ...plugins,
// ],
// },
// {
// input,
// external,
// output: {
// format: 'es',
// exports: 'named',
// file: 'build/trois.module.cdn.min.js',
// sourcemap: true,
// },
// plugins: [
// replace({
// 'from \'three\'': 'from \'https://unpkg.com/three@0.120.1/build/three.module.js\'',
// 'from \'three/examples': 'from \'https://unpkg.com/three@0.120.1/examples',
// 'from \'gsap\'': 'from \'https://unpkg.com/gsap@3.5.1/index.js\'',
// delimiters: ['', ''],
// }),
// ...plugins,
// terser(),
// ],
// },
2020-09-16 21:30:39 +08:00
{
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',
2020-10-04 06:49:05 +08:00
file: 'build/trois.js',
2020-09-16 21:30:39 +08:00
sourcemap: true,
},
plugins,
},
{
input,
external,
output: {
format: 'cjs',
2020-10-04 06:49:05 +08:00
file: 'build/trois.min.js',
2020-09-16 21:30:39 +08:00
sourcemap: true,
},
plugins: [
...plugins,
terser(),
],
},
];