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

Can't find variable: self #5667

Closed
lucasfeliciano opened this issue Feb 1, 2016 · 6 comments
Closed

Can't find variable: self #5667

lucasfeliciano opened this issue Feb 1, 2016 · 6 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@lucasfeliciano
Copy link
Contributor

First I had this error after importing a internal module

TypeError: undefined is not an object (evaluating 'GLOBAL.Text={
get defaultProps(){
throw getInvalidGlobalUseError('Text');}}')

Searching for a solution I found that removing es2015 from presets on .babelrc ( which in my case I use package.json ) would fix it but then I started to get this error.

Can't find variable: self

screen shot 2016-02-01 at 16 31 38

This is the file that is throwing the exception

// the whatwg-fetch polyfill installs the fetch() function
// on the global object (window or self)
//
// Return that as the export for use in Webpack, Browserify etc.
require('whatwg-fetch');
module.exports = self.fetch.bind(self);

I could't find any information about this so I decided to open I ticket.

Here are the package.json of my react-native project:

{
  "name": "xxxx",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "client-core": "path/to/my/module/repository#myBrach",
    "immutable": "^3.7.6",
    "react-native": "^0.19.0",
    "react-native-swiper": "^1.4.3",
    "react-native-vector-icons": "^1.0.4",
    "react-redux": "^4.1.2",
    "react-timer-mixin": "^0.13.3"
  },
  "devDependencies": {
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "eslint-plugin-react": "^3.15.0"
  },
  "babel": {
    "presets": [
      "react"
    ]
  }
}

package.json of the module that I installed:

{
  "private": true,
  "version": "1.0.0",
  "description": "Client side logic core",
  "dependencies": {
    "isomorphic-fetch": "^2.2.0",
    "lodash": "^4.0.0",
    "moment": "^2.10.6",
    "nock": "^5.2.1",
    "ramda": "^0.19.0",
    "redux": "^3.0.4",
    "redux-logger": "^2.1.1",
    "redux-thunk": "^1.0.0"
  },
  "devDependencies": {
    "babel-core": "^6.3.15",
    "babel-plugin-transform-object-rest-spread": "^6.3.13",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "chai": "^3.4.1",
    "chai-datetime": "^1.4.0",
    "deep-freeze": "0.0.1",
    "eslint": "^1.10.3",
    "eslint-plugin-mocha": "^1.1.0",
    "gulp": "^3.9.0",
    "gulp-babel": "^6.1.1",
    "gulp-babel-istanbul": "^0.11.0",
    "gulp-eslint": "^1.1.1",
    "gulp-mocha": "^2.2.0",
    "gulp-sequence": "^0.4.4",
    "isparta": "^4.0.0",
    "istanbul": "^0.4.2",
    "merge-stream": "^1.0.0",
    "mocha": "^2.3.4",
    "pre-commit": "^1.1.2",
    "sinon": "^1.17.2",
    "sinon-chai": "^2.8.0"
  },
  "scripts": {
    "test": "gulp",
    "test:watch": "mocha --compilers js:babel-core/register -w test/**/*.spec.js",
    "lint": "gulp lint"
  },
  "pre-commit": [
    "lint"
  ],
  "repository": {
    "type": "git",
    "url": "xxxxxx"
  },
  "author": "xxxx",
  "bugs": {
    "url": "xxxxxx"
  },
  "homepage": "xxxxx",
  "babel": {
    "presets": [
      "es2015",
      "react"
    ],
    "plugins": [
      "babel-plugin-transform-object-rest-spread"
    ]
  }
}
@facebook-github-bot
Copy link
Contributor

Hey lucasfeliciano, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

@lucasfeliciano
Copy link
Contributor Author

Closing this issue because it is related to:

JakeChampion/fetch#125

and

matthew-andrews/isomorphic-fetch#63

@billinghamj
Copy link

In a way, I feel that this is something which needs to be addressed by React Native directly. If the code isn't being used, it shouldn't be loaded, and it shouldn't matter.

@lucasfeliciano
Copy link
Contributor Author

@billinghamj Do you think that I should reopen the issue?

I don't think that the discussion will be extended.

@billinghamj
Copy link

It is an ongoing issue with React Native. Even if it isn't likely to be addressed any time soon, it should probably still be thought about.

@AndrewKralovec
Copy link

AndrewKralovec commented Aug 3, 2017

What is our current work around for this issue?
@billinghamj @billinghamj

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants