Browse Source

Builds: Add deprecation warning to `build/three.js` and `build/three.min.js`. (#25465)

* Builds: Add deprecation warning to build/three.js and build/three.min.js.

* Builds: Improve deprecation warning.
Michael Herzog 2 years ago
parent
commit
6663480c40
3 changed files with 35 additions and 6 deletions
  1. 1 0
      build/three.js
  2. 1 0
      build/three.min.js
  3. 33 6
      utils/build/rollup.config.js

+ 1 - 0
build/three.js

@@ -1,3 +1,4 @@
+console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated with r150+, and will be removed with r160. Please use ES Modules or alternatives: https://threejs.org/docs/index.html#manual/en/introduction/Installation' );
 /**
  * @license
  * Copyright 2010-2023 Three.js Authors

+ 1 - 0
build/three.min.js

@@ -1,3 +1,4 @@
+console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated with r150+, and will be removed with r160. Please use ES Modules or alternatives: https://threejs.org/docs/index.html#manual/en/introduction/Installation' );
 /**
  * @license
  * Copyright 2010-2023 Three.js Authors

+ 33 - 6
utils/build/rollup.config.js

@@ -263,6 +263,21 @@ ${ code }`;
 
 }
 
+function deprecationWarning() {
+
+	return {
+
+		renderChunk( code ) {
+
+			return `console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated with r150+, and will be removed with r160. Please use ES Modules or alternatives: https://threejs.org/docs/index.html#manual/en/introduction/Installation' );
+${ code }`;
+
+		}
+
+	};
+
+}
+
 const builds = [
 	{
 		input: 'src/Three.js',
@@ -288,15 +303,26 @@ const builds = [
 		],
 		output: [
 			{
-				format: 'umd',
+				format: 'cjs',
 				name: 'THREE',
-				file: 'build/three.js',
+				file: 'build/three.cjs',
 				indent: '\t'
-			},
+			}
+		]
+	},
+	{
+		input: 'src/Three.js',
+		plugins: [
+			addons(),
+			glsl(),
+			header(),
+			deprecationWarning()
+		],
+		output: [
 			{
-				format: 'cjs',
+				format: 'umd',
 				name: 'THREE',
-				file: 'build/three.cjs',
+				file: 'build/three.js',
 				indent: '\t'
 			}
 		]
@@ -308,7 +334,8 @@ const builds = [
 			glconstants(),
 			glsl(),
 			terser(),
-			header()
+			header(),
+			deprecationWarning()
 		],
 		output: [
 			{