prepublish.js 411 B

123456789101112
  1. const fs = require( 'fs' );
  2. const path = require( 'path' );
  3. const glob = require( 'glob' );
  4. const paths = glob.sync( path.resolve( __dirname, '../examples/jsm/**/*.js' ) );
  5. paths.forEach( p => {
  6. const content = fs.readFileSync( p, { encoding: 'utf8' } );
  7. const bareContent = content.replace( /(\.\.\/){2,}build\/three.module.js/g, 'three' );
  8. fs.writeFileSync( p, bareContent, { encoding: 'utf8' } );
  9. } );