|
2 | 2 | * @author botime / https://github.com/botime |
3 | 3 | */ |
4 | 4 |
|
5 | | -import { terser } from "rollup-plugin-terser"; |
| 5 | +import { terser } from 'rollup-plugin-terser'; |
6 | 6 |
|
7 | 7 | let terserOptions = { |
8 | 8 |
|
9 | | - output: { |
| 9 | + output: { |
10 | 10 |
|
11 | | - ecma: 5, |
12 | | - preamble: '// https://github.com/tensorspace-team/tensorspace/blob/master/LICENSE' |
| 11 | + ecma: 5, |
| 12 | + preamble: '// https://github.com/tensorspace-team/tensorspace/blob/master/LICENSE' |
13 | 13 |
|
14 | | - } |
| 14 | + } |
15 | 15 |
|
16 | 16 | }; |
17 | 17 |
|
18 | 18 | export default [ |
19 | 19 |
|
20 | | - // Build regular version for distribution |
21 | | - { |
22 | | - input: 'src/tensorspace.js', |
23 | | - output: [ { |
24 | | - |
25 | | - format: 'iife', |
26 | | - file: 'dist/tensorspace.js', |
27 | | - name: "TSP", |
28 | | - sourcemap: true, |
29 | | - |
30 | | - } ] |
31 | | - |
32 | | - }, |
33 | | - |
34 | 20 | // Build regular version for development |
35 | 21 | { |
36 | | - |
37 | | - input: 'src/tensorspace.dev.js', |
| 22 | + external: [ 'three', '@tweenjs/tween.js', '@tensorflow/tfjs', 'three-trackballcontrols', 'stats-js' ], |
| 23 | + input: 'src/tensorspace.js', |
38 | 24 | output: [ { |
| 25 | + globals: { |
| 26 | + 'three': 'THREE', |
| 27 | + '@tweenjs/tween.js': 'TWEEN', |
| 28 | + '@tensorflow/tfjs': 'tf', |
| 29 | + 'tensorspace': 'TSP', |
| 30 | + 'stats-js': 'Stats', |
| 31 | + 'three-trackballcontrols': 'THREE.TrackballControls' |
| 32 | + }, |
| 33 | + format: 'iife', |
| 34 | + file: 'dist/tensorspace.js', |
| 35 | + name: 'TSP', |
| 36 | + sourcemap: true |
39 | 37 |
|
40 | | - format: 'esm', |
41 | | - file: 'build/tensorspace.dev.esm.js', |
42 | | - name: "TSP", |
| 38 | + }, { |
| 39 | + |
| 40 | + format: 'cjs', |
| 41 | + file: 'dist/tensorspace.cjs.js', |
| 42 | + name: 'TSP', |
43 | 43 | sourcemap: true |
44 | 44 |
|
45 | 45 | } ] |
46 | 46 |
|
47 | 47 | }, |
48 | 48 |
|
49 | | - // Build minified version for distribution |
50 | | - { |
51 | | - |
52 | | - input: 'src/tensorspace.js', |
53 | | - plugins: [ terser( terserOptions ) ], |
54 | | - output: [ { |
55 | | - |
56 | | - format: 'iife', |
57 | | - file: 'dist/tensorspace.min.js', |
58 | | - name: "TSP", |
59 | | - sourcemap: true, |
60 | | - |
61 | | - } ] |
62 | | - |
63 | | - } |
64 | | - |
65 | | -] |
| 49 | + // // Build regular version for development |
| 50 | + // { |
| 51 | + // |
| 52 | + // input: 'src/tensorspace.dev.js', |
| 53 | + // output: [ { |
| 54 | + // |
| 55 | + // format: 'esm', |
| 56 | + // file: 'build/tensorspace.dev.esm.js', |
| 57 | + // name: "TSP", |
| 58 | + // sourcemap: true |
| 59 | + // |
| 60 | + // } ] |
| 61 | + // |
| 62 | + // }, |
| 63 | + // |
| 64 | + // // Build minified version for distribution |
| 65 | + // { |
| 66 | + // |
| 67 | + // input: 'src/tensorspace.js', |
| 68 | + // plugins: [ terser( terserOptions ) ], |
| 69 | + // output: [ { |
| 70 | + // |
| 71 | + // format: 'iife', |
| 72 | + // file: 'dist/tensorspace.min.js', |
| 73 | + // name: "TSP", |
| 74 | + // sourcemap: true, |
| 75 | + // |
| 76 | + // } ] |
| 77 | + // |
| 78 | + // } |
| 79 | + |
| 80 | +]; |
0 commit comments