I'd like to know if it's possible using react-script
to rename src
to something else like app
folder
相关问题
- How to toggle on Order in ReactJS
- Refreshing page gives Cannot GET /page_url in reac
- Adding a timeout to a render function in ReactJS
- React Native Inline style for multiple Text in sin
- Issue with React.PropTypes.func.isRequired
相关文章
- Why would we use useEffect without a dependency ar
- Is it possible to get ref of props.children?
- Stateless function components cannot be given refs
- React testing library: Test attribute / prop
- React/JestJS/Enzyme: How to test for ref function?
- Material-UI [v0.x] RaisedButton on hover styles
- Remove expo from react native
- ReactJS toLowerCase is not a function
I know this is an old question but I'm still gonna post my solution since it might help someone.
I got it working by doing the following:
npm run eject
. This exposes some internal configuration stuff from create-react-apppackage.json
and edit the respective regexes underjest.collectCoverageFrom
andjest.testMatch
to match your test pathappSrc
,appIndexJs
andtestsSetup
in theconfig/paths.js
filePerhaps a symbolic link might address your reasons for wanting to do this:
ln -s ./src/ ./app
The
src
folder will remain but you can work with it as if it was theapp
folder.If, like me you're using vscode you can also do:
Cmd-shift-p
search workspace settings, and add the following:You could do similarly with other editors
You can use react-app-rewired to override react paths configuration. In my case, I can change the paths in config-overrides.js file
Not sure if this answers your question but I'll give it a shot. My directory structure looks like this:
My /root/package.json has this in it:
and my /root/app/package.json looks like this:
To run the development version of Reactjs, in the /root I can just npm run serve to serve up the dev version.
I am using node and express, so to run the production version of Reactjs, in the /root I can just npm run build to create the /root/app/build directory. I have a router that looks like this:
so when I run /root/app.js in node and surf to "/" it opens up /root/app/public/index.html and then /root/app/index.js.
Hopefully that helps.
Create file in root of your project, insert this code and run.