GithubHelp home page GithubHelp logo

Comments (7)

sokra avatar sokra commented on April 28, 2024 10

Ok than it should ignore net and tls in the browser field in the package.json. You propably want to submit a PR to request adding this field.

{
  "browser": {
    "net": false,
    "tls": false
  }
}

Or you can do it globally in the webpack configuration with:

{
  node: {
    net: "empty",
    tls: "empty"
  }
}

from react-starter.

sokra avatar sokra commented on April 28, 2024 2

I don't think this library is intended for in-browser usage...

from react-starter.

nrempel avatar nrempel commented on April 28, 2024 1

@sokra

{
  "browser": {
    "net": false,
    "tls": false
  }
}

Does not seem to be a part of the package.json spec. I can't see any documentation here https://docs.npmjs.com/files/package.json.

Is this is a convention that webpack uses?

Thanks.

**Edit:

Is it related to this spec? https://github.com/defunctzombie/package-browser-field-spec

from react-starter.

pltod avatar pltod commented on April 28, 2024

Yes originally the library is not intended to work in the browser but now it works. I am using it inside React components to make HTTP calls to node.js server. As far as I know both request and superagent (https://github.com/visionmedia/superagent) can be used as alternatives to jQuery AJAX

I guess most people that are using React are not interested of using jQuery so they need something to communicate with the server. The theory for isomorphic apps :) - http://www.slideshare.net/spikebrehm/2014-0313fluent - says that we have environment agnostic libs (this is the case with request) and shimmed per environment (this is the case for superagent - it has browser property inside package.json to denote browser script that must be included during the build)

I just tried to use superagent instead of request....the webpack build now does not have errors but have warnings.

I am really curious what is the best approach of using one of these in the browser with webpack...

from react-starter.

pltod avatar pltod commented on April 28, 2024

It works with 'node' parameter in webpack configuration. Thanks for the fast answer.

from react-starter.

lai32290 avatar lai32290 commented on April 28, 2024

This is help for me! Thanks for you

from react-starter.

thg303 avatar thg303 commented on April 28, 2024

any practical solution for this issue? or I have to push the 'eject' and leave the starter?

from react-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.