Comments (8)
@sthzg: Thank you, that looks really good to me. Could you please update the README to include this feature? Would be happy to include the pull request for it :)
from react-webpack-template.
Great. Just read in the README about the option to run it with a global webpack installation (will check if everything runs as expected that way too).
One thing I am not sure about are the implications for windows users. AFAIK they can't set env variables from the command line (exactly) like that (further they seem to be fragmented to different shells like powershell, cmd, cygwin). Do you have experience with this topic? Otherwise I have a win 7 and win 10 virtualbox, so I could experiment with it a bit.
from react-webpack-template.
That was the reason I did it with minimist. I can give the environment via command line parameter in this case ("serve": "node server.js --env=dev"). However, this just "emulates" the real node environment. I usually code on a mac too, so you dont have that problem here. However I know that there are problems with some software systems (like react.js reads the node env so it can assume that it should use the dev or live version).
Will also investigate in this, I got a Win System nearby.
from react-webpack-template.
Hm, what do you think about this? It looks promising and as it is officially supported should work cross-platform? A quick test of adding config
shows test variables are correctly exposed:
https://docs.npmjs.com/misc/scripts#configuration
so adding this to package.json
{
//...
"config": {
"devserver_port": 8000,
"testserver_port": 8080
},
// ...
exposes two variables process.env.npm_package_config_devserver_port
and process.env.npm_package_config_testserver_port
. And with npm config set react-webpack-template:devserver_port 12345
the port can be changed.
Update
The one caveat I see is that when installing the react-webpack-generator globally then npm does not read .npmrc
files from within the project directory, but only from the user directory. That again means that setting the value in one project affects the setting globally (not installing the react-webpack-generator globally should "fix" that though).
from react-webpack-template.
Basically it seems like a good idea. I will dig into it and look how we could the best results for both plattforms.
from react-webpack-template.
Sounds great. For reference I'v added a second commit here to illustrate the later approach e4c0285.
from react-webpack-template.
@weblogixx I vote for closing this issue for the time being and possibly renewing it once the new version is stable (I saw that the default port is now in the config, but didn't check whether it's dynamic).
from react-webpack-template.
I think so, too. The new version makes it possible to set the port directly in the config, we could also add it to package.json... Will have to think about this.
from react-webpack-template.
Related Issues (20)
- V1 -- Remove --open call on npm start HOT 3
- V2 -- Refactor index.html to be template-driven HOT 8
- V2 -- Update tests to use inline functions HOT 1
- V1 -- Refactor tests to use inline function HOT 1
- V2 -- Add static directory to build step HOT 1
- Update README in src/config dir HOT 1
- V2 -- Update coverage information
- V2 -- Update copying static files to copy-webpack-plugin
- V2 -- Fix eslint rule deprecation warning
- V2 -- serve:dist does not load page HOT 1
- V2 -- Update deprecated es2015-native-modules preset HOT 1
- V2 -- Upgrading to react-hot-loader v3? HOT 2
- V2 -- Centralize defaultPort setting HOT 5
- Module build failed: Error: Couldn't find preset "es2015" HOT 1
- V2 -- Divide env config into appEnv and nodeEnv HOT 1
- V1 -- Add temporary fix for `ReactMount` bug HOT 1
- V2 -- Redundant entry in webpack Base HOT 1
- V2 -- HMR - named Modules
- V2 -- Webpack - NoErrorsPlugin is deprecated
- Is there an easy way to add Express to this webpack-config-template for 'dist'?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-webpack-template.