Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency on @babel/runtime in esm versions #215

Open
vitalymind opened this issue Jul 11, 2022 Discussed in #214 · 4 comments
Open

Dependency on @babel/runtime in esm versions #215

vitalymind opened this issue Jul 11, 2022 Discussed in #214 · 4 comments

Comments

@vitalymind
Copy link

Discussed in #214

Originally posted by vitalymind July 11, 2022
hi, I am trying to use three-nebula as es module. I assume that after installing npm package "..\node_modules\three-nebula\build\esm" folder should contain pre-built and ready to use library.

However I found following imports that likely should not be there, namely:

7 times import _defineProperty from "@babel/runtime/helpers/defineProperty"; in files:
\three-nebula\build\esm\core\fromJSONAsync.js
\three-nebula\build\esm\initializer\BodySprite.js
\three-nebula\build\esm\initializer\constants.js
\three-nebula\build\esm\initializer\Texture.js
\three-nebula\build\esm\renderer\GPURenderer\Desktop\index.js
\three-nebula\build\esm\renderer\GPURenderer\Mobile\index.js
\three-nebula\build\esm\utils\index.js

1 time import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; in file
\three-nebula\build\esm\initializer\Position.js

From what I understand built three-nebula should not depend on babel, babel used only for building three-nebula it self.
Just to make it clear, minified built version "three-nebula.js" works as expected, no dependency on babel

Can it be fixed?

@vitalymind
Copy link
Author

In most cases there is a following portion of code in the top of file.

import _defineProperty from "@babel/runtime/helpers/defineProperty";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

It looks like building does not happen correctly

@rohan-deshpande
Copy link
Collaborator

Hmm, thanks for reporting, I will look into this.

@NicolasNewman
Copy link

@rohan-deshpande Was the reason for this error ever discovered? I'm encountering the same issue.

@Raishav
Copy link

Raishav commented Apr 23, 2024

Hi, Was this resolved - or do we have a workaround for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants