rollup.config.js 597 B

12345678910111213141516171819202122232425262728293031323334
  1. import * as fs from 'fs';
  2. var outro = `
  3. Object.defineProperty( exports, 'AudioContext', {
  4. get: function () {
  5. return exports.getAudioContext();
  6. }
  7. });`;
  8. function glsl () {
  9. return {
  10. transform ( code, id ) {
  11. if ( !/\.glsl$/.test( id ) ) return;
  12. return 'export default ' + JSON.stringify(
  13. code
  14. .replace( /[ \t]*\/\/.*\n/g, '' )
  15. .replace( /[ \t]*\/\*[\s\S]*?\*\//g, '' )
  16. .replace( /\n{2,}/g, '\n' )
  17. ) + ';';
  18. }
  19. };
  20. }
  21. export default {
  22. entry: 'src/Three.js',
  23. dest: 'build/three.js',
  24. moduleName: 'THREE',
  25. format: 'umd',
  26. plugins: [
  27. glsl()
  28. ],
  29. outro: outro
  30. };