GithubHelp home page GithubHelp logo

Comments (5)

bebraw avatar bebraw commented on May 21, 2024

Unfortunately there's no simple cross-platform way to do this as far as I can see. I added an alternative solution and a warning about this at the book. Hopefully Webpack 2 will fix this (allows params to be passed directly).

from react-book.

JaxCavalera avatar JaxCavalera commented on May 21, 2024

Was this ever resolved? I'm still trying to work out how to set a new environment variable within my NPM Script on a Windows 10 computer and nothing works. hard to imagine that this is still the situation being we're almost in February 2016 now and it's been a known issue since mid last year.

I'm hoping that I've just not yet found the right source of information that covers how to do this.

from react-book.

bebraw avatar bebraw commented on May 21, 2024

@JaxCavalera I worked around this through npm. const TARGET = process.env.npm_lifecycle_event; gives us the information we need. I.e. if you run npm run build, TARGET will point at build. You can do branching etc. based on that.

So the solution was simply to avoid using env variables. Simple as that.

from react-book.

JaxCavalera avatar JaxCavalera commented on May 21, 2024

@bebraw yep that turned out to be the general gist of how I resolved it also. bit different in how i made it work but the underlying approach of avoiding env vars for the task is the same. I just have pointed to the wrong target or something I think but I've got that all proposed on reactiflux so hopefully can get it resolved.. and i'll stop here since this is no longer related to using environment variables for the task of multiple webpack configurations.

from react-book.

bebraw avatar bebraw commented on May 21, 2024

@JaxCavalera Ok. Note that another possibly valid alternative is to go through process.argv. That will require some coding on configuration side, though, since you need to parse etc.

from react-book.

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.