浏览代码

Rollup: Replace addons three.module.js dependency.

Mr.doob 4 年之前
父节点
当前提交
6617b7ca47
共有 1 个文件被更改,包括 24 次插入0 次删除
  1. 24 0
      utils/build/rollup.config.js

+ 24 - 0
utils/build/rollup.config.js

@@ -170,6 +170,27 @@ function glconstants() {
 
 
 }
 }
 
 
+function addons() {
+
+	return {
+
+		transform( code, id ) {
+
+			if ( /\/examples\/jsm\//.test( id ) === false ) return;
+
+			code = code.replace( 'build/three.module.js', 'src/Three.js' );
+
+			return {
+				code: code,
+				map: null
+			};
+
+		}
+
+	};
+
+}
+
 function glsl() {
 function glsl() {
 
 
 	return {
 	return {
@@ -259,6 +280,7 @@ export default [
 	{
 	{
 		input: 'src/Three.js',
 		input: 'src/Three.js',
 		plugins: [
 		plugins: [
+			addons(),
 			glconstants(),
 			glconstants(),
 			glsl(),
 			glsl(),
 			buble( {
 			buble( {
@@ -282,6 +304,7 @@ export default [
 	{
 	{
 		input: 'src/Three.js',
 		input: 'src/Three.js',
 		plugins: [
 		plugins: [
+			addons(),
 			glconstants(),
 			glconstants(),
 			glsl(),
 			glsl(),
 			buble( {
 			buble( {
@@ -306,6 +329,7 @@ export default [
 	{
 	{
 		input: 'src/Three.js',
 		input: 'src/Three.js',
 		plugins: [
 		plugins: [
+			addons(),
 			glconstants(),
 			glconstants(),
 			glsl(),
 			glsl(),
 			header()
 			header()