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

Figure out how to make package.json scripts work on Windows #8

Closed
bebraw opened this issue May 5, 2015 · 5 comments
Closed

Figure out how to make package.json scripts work on Windows #8

bebraw opened this issue May 5, 2015 · 5 comments

Comments

@bebraw
Copy link
Member

bebraw commented May 5, 2015

Ideally there should be some cross-platform way to achieve this.

Related to f2f4b35#commitcomment-11029492 .

bebraw referenced this issue May 5, 2015
Looks like just `config` can be problematic on some platforms.
@bebraw
Copy link
Member Author

bebraw commented May 5, 2015

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).

@bebraw bebraw closed this as completed May 5, 2015
@JaxCavalera
Copy link

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.

@bebraw
Copy link
Member Author

bebraw commented Jan 28, 2016

@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.

@JaxCavalera
Copy link

@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.

@bebraw
Copy link
Member Author

bebraw commented Jan 28, 2016

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants