-
Notifications
You must be signed in to change notification settings - Fork 31.1k
Babel cache #1369
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
Babel cache #1369
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| const commandLineArgs = require('command-line-args'); | ||
|
|
||
| const optionDefinitions = [ | ||
| { name: 'env', alias: 'e', type: String } | ||
| ]; | ||
|
|
||
| const args = commandLineArgs(optionDefinitions); | ||
| const config = args.env === "production" ? require( "./prodConfig" ) : require( "./localConfig" ); | ||
|
|
||
| module.exports = { | ||
| 'BACKEND_URL': config.backendUrl | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = { | ||
| backendUrl: "http://localhost:3000" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = { | ||
| backendUrl: "http://www.production.com" | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,9 @@ | |
| "version": "1.0.0", | ||
| "scripts": { | ||
| "dev": "next", | ||
| "build": "next build", | ||
| "clean": "rimraf .\\node_modules\\.cache", | ||
| "build-dev": "npm run clean && next build --env=development", | ||
| "build-prod": "npm run clean && next build --env=production", | ||
| "start": "next start" | ||
| }, | ||
| "dependencies": { | ||
|
|
@@ -12,6 +14,8 @@ | |
| "react-dom": "^15.4.2" | ||
| }, | ||
| "devDependencies": { | ||
| "command-line-args": "^4.0.2", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't understand why this package was needed
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that this package makes params from command line easy to collect |
||
| "rimraf": "^2.6.1", | ||
| "babel-plugin-transform-define": "^1.2.0" | ||
| }, | ||
| "author": "", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not simply
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we need to pass additional parameters like instance (we need to pass 2 params)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then can just add another env var.
IMHO that's unrelated to what the example is trying to convey. There's no need for
command-line-argsto get universal config working.