rollup.config.js 682 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. var transformedCode = '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. return {
  19. code: transformedCode,
  20. map: { mappings: '' }
  21. }
  22. }
  23. };
  24. }
  25. export default {
  26. entry: 'src/Three.js',
  27. dest: 'build/three.js',
  28. moduleName: 'THREE',
  29. format: 'umd',
  30. plugins: [
  31. glsl()
  32. ],
  33. outro: outro
  34. };