Reputation: 2099
I created "create-react-app" in a subfolder called client. My package.json has to be in the root directory though (heroku).
This is the structure:
- app
- client
- node_modules
- index.js
- components
- ...
- package.json
- Procfile
This is my package.json file:
{
"name": "client",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001/",
"devDependencies": {
"react-scripts": "0.6.1"
},
"dependencies": {
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"firebase": "^3.4.1",
"jquery": "^3.1.1",
"react": "^15.3.2",
"react-dom": "^15.3.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
How to tell package.json to look for the app in the client subfolder and build it there?
Upvotes: 0
Views: 651
Reputation: 1253
You can set your NODE_PATH environment variable like this:
export NODE_PATH=path/to/app/node_modules
You can find more information about it in the official docs: https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
Upvotes: 1