Skip to content

Commit

Permalink
Builds: Add deprecation warning to build/three.js and `build/three.…
Browse files Browse the repository at this point in the history
…min.js`. (#25465)

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

* Builds: Improve deprecation warning.
  • Loading branch information
Mugen87 authored Feb 8, 2023
1 parent d440b3e commit 6663480
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
1 change: 1 addition & 0 deletions build/three.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions build/three.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 33 additions & 6 deletions utils/build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'
}
]
Expand All @@ -308,7 +334,8 @@ const builds = [
glconstants(),
glsl(),
terser(),
header()
header(),
deprecationWarning()
],
output: [
{
Expand Down

0 comments on commit 6663480

Please sign in to comment.