Giter Site home page Giter Site logo

Comments (7)

foot avatar foot commented on July 19, 2024

Building a requirable react seems to work. But I'm not sure if this is the-way-to-do-it?

browserify -r react > react-require.js

And an updated template:

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">

    <title>Index</title>
    <script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>
    <script src="react-require.js" type="text/javascript" charset="utf-8"></script>
    <script src="bower_components/react-geosuggest/dist/react-geosuggest.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8">
</head>

    <body>
    <div id="app">
    </div>

    <script type="text/javascript" charset="utf-8">
        React = require('react');
        var GeosuggestFactory = React.createFactory(Geosuggest);
        React.render(GeosuggestFactory(), document.getElementById('app'));
    </script>
    </body>
</html>

from react-geosuggest.

foot avatar foot commented on July 19, 2024

This might be the go:

https://github.com/rluba/browserify-global-shim

Replaces require('react')s with (window.React)s.

from react-geosuggest.

ro-ka avatar ro-ka commented on July 19, 2024

Hi! Hm, will try both and see which works. Should be one file without requires at all. Thanks for reporting!

from react-geosuggest.

ro-ka avatar ro-ka commented on July 19, 2024

I tried the browserify-global-shim and browserify-shim but it didn’t change the generated file… Do you have any other ideas or why it didn’t work?

I used this in the package.json:

  "browserify-shim": {
    "React": "global:react"
  },

from react-geosuggest.

foot avatar foot commented on July 19, 2024

Created a PR w/ the code i used! #45

from react-geosuggest.

ro-ka avatar ro-ka commented on July 19, 2024

Great! Thanks a lot! Wondering why it didn’t work for me. Will release soon, finishing something more.

from react-geosuggest.

ro-ka avatar ro-ka commented on July 19, 2024

Released as 1.9.1.

from react-geosuggest.

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.