From e61c5ccb4a9d513a725b752b6a4d753ddbc0a999 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Thu, 17 Sep 2020 10:57:13 +0200 Subject: [PATCH] fix rollup forOf --- rollup.config.js | 3 ++- src/core/useThree.js | 8 ++++---- src/materials/SubSurfaceMaterial.js | 2 +- src/tools.js | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 4de726a..2db192a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -17,7 +17,8 @@ const plugins = [ commonjs(), vue(), buble({ - transforms: { forOf: false }, + // transforms: { forOf: false }, + objectAssign: 'Object.assign', }), ]; diff --git a/src/core/useThree.js b/src/core/useThree.js index 614b917..df6426f 100644 --- a/src/core/useThree.js +++ b/src/core/useThree.js @@ -68,9 +68,9 @@ export default function useThree() { */ function init(params) { if (params) { - for (const [key, value] of Object.entries(params)) { + Object.entries(params).forEach(([key, value]) => { conf[key] = value; - } + }); } if (!obj.scene) { @@ -88,9 +88,9 @@ export default function useThree() { if (conf.orbit_ctrl) { obj.orbitCtrl = new OrbitControls(obj.camera, obj.renderer.domElement); if (conf.orbit_ctrl instanceof Object) { - for (const [key, value] of Object.entries(conf.orbit_ctrl)) { + Object.entries(conf.orbit_ctrl).forEach(([key, value]) => { obj.orbitCtrl[key] = value; - } + }); } } diff --git a/src/materials/SubSurfaceMaterial.js b/src/materials/SubSurfaceMaterial.js index 347d3be..467327a 100644 --- a/src/materials/SubSurfaceMaterial.js +++ b/src/materials/SubSurfaceMaterial.js @@ -1,6 +1,6 @@ import { Color, ShaderMaterial as TShaderMaterial, UniformsUtils } from 'three'; -import ShaderMaterial from './ShaderMaterial.js'; import SubsurfaceScatteringShader from './SubsurfaceScatteringShader.js'; +import ShaderMaterial from './ShaderMaterial.js'; export default { extends: ShaderMaterial, diff --git a/src/tools.js b/src/tools.js index 39d7132..23efd52 100644 --- a/src/tools.js +++ b/src/tools.js @@ -1,8 +1,8 @@ export function setFromProp(o, prop) { if (prop instanceof Object) { - for (const [key, value] of Object.entries(prop)) { + Object.entries(prop).forEach(([key, value]) => { o[key] = value; - } + }); } };