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

Using new.target crashes the bundler #22862

Closed
3 tasks done
dzek69 opened this issue Jan 3, 2019 · 6 comments
Closed
3 tasks done

Using new.target crashes the bundler #22862

dzek69 opened this issue Jan 3, 2019 · 6 comments
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@dzek69
Copy link

dzek69 commented Jan 3, 2019

Environment

Run react-native info in your terminal and paste its contents here.

  React Native Environment Info:
    System:
      OS: Windows 10
      CPU: (8) ia32 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
      Memory: 4.32 GB / 15.89 GB
    Binaries:
      Node: 11.2.0 - C:\nodejs\node.EXE
      Yarn: 1.12.3 - C:\Apps\Yarn\bin\yarn.CMD
      npm: 6.4.1 - C:\nodejs\npm.CMD
    IDEs:
      Android Studio: Version  3.2.0.0 AI-181.5540.7.32.5056338

Description

Using new.target causes developer bundler to fail. Unexpected token '.' red screen is being shown. new.target is part of ECMAScript 2015 (6th Edition, ECMA-262) standard according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target

I am currently unable to use some libraries, like whatwg-url (while trying to work around #16434) because of this.

Production version builds just fine but app crashes with same error, just presented as android app error.

This can be taken as duplicate of #8848, but I feel this was wronly closed. Babel does support this now: https://babeljs.io/docs/en/babel-plugin-transform-new-target however I feel this should/could be fixed without transpiling [?].

Reproducible Demo

function() {
  if (new.target) {}
}

or just import whatwg-url.

@react-native-bot react-native-bot added the Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. label Jan 3, 2019
@assyme
Copy link

assyme commented Jan 8, 2019

Spent hours debugging this and found the same exact issue. Were you able to solve this?

@dzek69
Copy link
Author

dzek69 commented Jan 8, 2019

No, I just used another library. Forking a library and replacing new.target code (this instanceOf Stuff) should be possible if you MUST use any exact library. But that's annoying way to work around the issue, I know.

@assyme
Copy link

assyme commented Jan 8, 2019

Thanks for your reply. Which library did you end up using?

@dzek69
Copy link
Author

dzek69 commented Jan 8, 2019

@stale
Copy link

stale bot commented Aug 4, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 4, 2019
@stale
Copy link

stale bot commented Aug 11, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Aug 11, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests

4 participants