Comments (4)
@gaearon , if I understood your concerns correctly, the frustrating part is that code like the following will become more difficult to maintain with the increased number of commands in later versions.
var relativePath = isInNodeModules ? '../../..' : '..';
if (process.argv[2] === '--debug-template') {
relativePath = '../template';
}
If so, with match-js or a similar approach, I should be able to refactor the code similar to the following, though not exactly in your proposed form
relativePath = match( env )(
CASE(REPO, ...),
CASE(DEPENDENCY, ...),
CASE(EJECTED, ...),
CASE(otherwise, ...)
);
where env
could be process.argv
or other value that represents the execution environment.
Currently, I see that --debug-template
and --smoke-test
are both set at process.argv[2]
, and there is no check for EJECTED
because scripts/eject.js
is the only involved script.
To help me understand your problem correctly, could you, from a user's perspective, list some test commands that set flag(s)?
In my forked repo, I will test my ideas. I hope that we can move towards a solution that you wanted.
Cheers
from create-react-app.
These flags are all internal and we don’t want to expose this code for the user. They are only useful for testing and local development of create-react-app
itself. So if
statements are not a problem and we don’t need to refactor them. What we need is a way to cut some code after eject
ing.
from create-react-app.
@gaearon ,
The above change deletes dead code on eject
ing; However, this does not prevent users from using npm start --debug-template
before react-scripts
is eject
ed. At lease, we don't expose the flag to general users.
I will think if we could hide the flag and cut off the code on the time of building react-scripts
.
If you think the current progress is OK, I will do some tests and create a PR.
from create-react-app.
This was in #257.
from create-react-app.
Related Issues (20)
- Create react app HOT 1
- login issue
- my sign in not working
- HMR not working
- [email protected]
- "npx create-react-app" doesn't generate src or public folders HOT 1
- Usage override/workaround/hack with ESLint 9
- Frontend Host doesn't match the current host in the browser, so it's probably incorrect. Links in emails and file downloads from the API will not work. Click here to update. HOT 1
- [https://newsroom.spotify.com/news/](https://deezer.page.link/fCBsxrTRUZvKbLkA8) HOT 3
- react-scripts/v/5.1.0-next.14 contains multiple security vulnerabilities for inner modules
- Issue in creating react app HOT 4
- cra打包路由切换FiberRootNode会新增,webpack打包就不会 HOT 1
- Error -4048 and Error -4058 and ENOENT, HOT 1
- Des erreurs apres installation de mui sur un projet React 18.0.0 ou supérieur HOT 1
- del proyecto
- how i can run react program in vs code HOT 4
- React JS HOT 4
- @babel/plugin-proposal-private-property-in-object missing from babel-preset-react-app dependencies
- Npx create-react-app: 8 vulnerabilities (2 moderate, 6 high) in new react app HOT 1
- 不动 啊
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 create-react-app.