34 lines
614 B
JavaScript
34 lines
614 B
JavaScript
import * as fs from 'fs';
|
|
|
|
var outro = `
|
|
Object.defineProperty( exports, 'AudioContext', {
|
|
get: function () {
|
|
return exports.getAudioContext();
|
|
}
|
|
});`;
|
|
|
|
function glsl () {
|
|
return {
|
|
transform ( code, id ) {
|
|
if ( !/\.glsl$/.test( id ) ) return;
|
|
|
|
return 'export default ' + JSON.stringify(
|
|
code
|
|
.replace( /[ \t]*\/\/.*\n/g, '' )
|
|
.replace( /[ \t]*\/\*[\s\S]*?\*\//g, '' )
|
|
.replace( /\n{2,}/g, '\n' )
|
|
) + ';';
|
|
}
|
|
};
|
|
}
|
|
|
|
export default {
|
|
entry: 'src/third_party/three/Three.js',
|
|
dest: 'build/three.js',
|
|
moduleName: 'THREE',
|
|
format: 'umd',
|
|
plugins: [
|
|
glsl()
|
|
],
|
|
outro: outro
|
|
}; |