Browse Source

Merge pull request #15543 from gkjohnson/three-module-variable-rename

Update Built UMD File Readability
Mr.doob 6 years ago
parent
commit
0d99e4967b
1 changed files with 17 additions and 2 deletions
  1. 17 2
      rollup-examples.config.js

+ 17 - 2
rollup-examples.config.js

@@ -17,6 +17,20 @@ function createOutput( file ) {
 		treeshake: false,
 		external: p => p !== inputPath,
 
+		plugins: [{
+
+			generateBundle: function(options, bundle) {
+
+				for ( var key in bundle ) {
+
+					bundle[ key ].code = bundle[ key ].code.replace( /three_module_js/g, 'THREE' );
+
+				}
+
+			}
+
+		}],
+
 		output: {
 
 			format: 'umd',
@@ -29,8 +43,9 @@ function createOutput( file ) {
 
 			banner:
 				'/**\n' +
-				` * Generated from '${ path.relative( '.', inputPath.replace( /\\/, '/' ) ) }'\n` +
-				' */\n'
+				` * Generated from '${ path.relative( '.', inputPath ).replace( /\\/g, '/' ) }'\n` +
+				' */\n',
+			esModule: false
 
 		}