()
| 38 | |
| 39 | const modules = ['webgpu']; // TODO: also generate math build |
| 40 | const generateModuleBuild = () => { |
| 41 | return modules.map(module => { |
| 42 | return { |
| 43 | input: `src/${module}/index.js`, |
| 44 | output: [ |
| 45 | { |
| 46 | file: `./lib/p5.${module}.js`, |
| 47 | format: 'iife', |
| 48 | plugins: [ |
| 49 | bundleSize(`p5.${module}.js`) |
| 50 | ] |
| 51 | }, |
| 52 | { |
| 53 | file: `./lib/p5.${module}.min.js`, |
| 54 | format: 'iife', |
| 55 | sourcemap: 'hidden', |
| 56 | plugins: [ |
| 57 | terser({ |
| 58 | compress: { |
| 59 | global_defs: { |
| 60 | IS_MINIFIED: true |
| 61 | } |
| 62 | }, |
| 63 | format: { |
| 64 | comments: false |
| 65 | } |
| 66 | }), |
| 67 | bundleSize(`p5.${module}.min.js`) |
| 68 | ] |
| 69 | }, |
| 70 | { |
| 71 | file: `./lib/p5.${module}.esm.js`, |
| 72 | format: 'esm', |
| 73 | plugins: [ |
| 74 | bundleSize(`p5.${module}.esm.js`) |
| 75 | ] |
| 76 | } |
| 77 | ], |
| 78 | external: ['../core/main'], |
| 79 | plugins: [ |
| 80 | ...plugins |
| 81 | ] |
| 82 | }; |
| 83 | }); |
| 84 | }; |
| 85 | |
| 86 | rmSync('./dist', { |
| 87 | force: true, |
no test coverage detected