React Native Config Not Picking Up .env Changes - react-native

My react-native-config isn't picking up changes in my .env
Only when I uninstall and then reinstall does react-native-config pick up the changes in my .env file.

Related

How do I use a local plugin with ParcelJS

I use ParcelJS to bundle my JavaScript code. I want to modify an existing plugin (say the Elm plugin) to convert some special files on the fly with our own proprietary transpiler to JavaScript.
Therefor I cannot install the plugin from teh npmjs repo via Yarn into the node_modules folder. I have the relevant plugin files (asset.js, index.js, package.json) in a local directory myplugin. How do I tell ParcelJS to use them?
If you have your plugin with a package.json in the directory myplugin you can add add it (as a dev dependency) with the following command:
yarn add ./myplugin --dev
Yarn will copy the plugin to the node_modules folder. When you have changed stuff in your plugin folder increase the version number in the plugin's package.json and run yarn upgrade.

Why does npm run eject look through all my project folders?

I am trying to run an npm run eject on a new project so I can configure Webpack files, but I got this message:
✗ npm run eject
> location#0.1.0 eject /Users/danale/Projects/location
> react-scripts eject
NOTE: Create React App 2 supports TypeScript, Sass, CSS Modules and more without ejecting: https://reactjs.org/blog/2018/10/01/create-react-app-v2.html
? Are you sure you want to eject? This action is permanent. Yes
This git repository has untracked files or uncommitted changes:
Why is it referencing all the project folders? To be clear I am running the above command inside of one project folder I just created with CRA.
I am not in the folder with all my projects, I am in the folder with one newly created project. With that said, why is npm referencing all my other projects?
Before you eject a react project created with create-react-app they give you the following cookie cutter response of:
NOTE: Create React App 2 supports TypeScript, Sass, CSS Modules and more without ejecting: https://reactjs.org/blog/2018/10/01/create-react-app-v2.html
? Are you sure you want to eject? This action is permanent. Yes
This git repository has untracked files or uncommitted changes:
The reason for this is a lot of people want to have a granular level of control of their webpack.config.js file and you've to eject to get access to this file as it's obfuscated away within your react-scripts module. Now the part of the eject warning message saying:
NOTE: Create React App 2 supports TypeScript, Sass, CSS Modules and more without ejecting: https://reactjs.org/blog/2018/10/01/create-react-app-v2.html
Is to inform you that you don't have to eject to take advantage of preprocessors, TypeScript, etc.... They tell you this because create-react-app didn't always support the easy addition of this functionality so people would eject to be able to use preprocessors and TypeScript.
You're correct that in order to use SASS all you have to do is:
Install the node-sass module with a: npm install node-sass
Then just create your .scss files and import your desired .scss file in the component you wish to use the styling at. Alternatively, you could also just have a "main" .scss file whose only job is to import other .scss files relevant for your app. Then import this "main" .scss file within your App.js file.
Now as for this part of the eject warning message:
This git repository has untracked files or uncommitted changes:
You're probably getting this because you've set up a git repository for a parent folder where you ran the create-react-app CLI. Basically, in one of your parent folders where your create-react-app interface is located at is a .git/config that points upstream to one of your remote repositories.
Hopefully that helps!
Between what I read in the documentation suggested in the error message and from tinkering with it, all you have to do is:
npm install node-sass
and then you can start changing css files to scss and creating other scss files for your project. No npm run eject necessary.

How to force npm to use global eslint without removing local eslint?

I have local eslint installed for a react project but I want to run a different eslint from the global eslint (different version and plugins), is there a --global flag or some trick that would enable me to do so or must I include the absolute path to the global eslint?

Where is the node_modules directory located in a React Native project?

In a simple JavaScript application that utilizes npm modules, I have a package.json, and after running npm install I get a node_modules folder.
How does this work in React Native, where is the node_modules directory in a React Native project?
The location should be in the root of your project. Assume your root project directory on AwesomeProject it should be on AwesomeProject/node_modules.
How do you create your react native app ? If you using create-react-native-app it will automatically install the npm packages.
create-react-native-app AwesomeProject
cd AwesomeProject
npm start
If not, try run npm install on your root project (contain package.json).
npm install
you will see node_modules in the root of your project;
As you said you can see the module in when you do ls in terminal. That means that "node_module" is in .gitignore. Atom excludes files which are gitignored. You can disable that settings.
Following are the steps for mac.
Go to atom preferences > Core > and untick "Exclude VCS Ignored Path" option.
There will be similar settings in windows also if you are developing in windows

React Native - Save project without node_modules folder, and create it later?

I've created a react native project with react-native init. Everything is fine, but now I want to save the project to some source control without the large node_modules library (80mb).
So later (when the source is checked out on a different computer for example) when I try to recreate the folder I use npm install.
But now when I run react-native start (i am using windows) i get the error:
"cannot find module '.nodules/es5'"
The react-native init command did something inside the node_modules that the npm install is not doing.
What am I missing?
It's not clear from your description how you have created the project in the first place. I'd recommend using react-native init projectName to properly create a project. To run react-native you need to first install react native globally- npm install -g react-native-cli
If you're using git and github for source control-
react-native init command automatically generates a .gitignore file. Following files are excluded from being added in the source control.
OSX-
.DS_Store
Xcode-
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
Android/IJ
.idea
.gradle
local.properties
Node.js
node_modules/
npm-debug.log
So even if you run git add . (which tracks all the files recursively in the source control) the aforementioned files will not be tracked.
Next time, if you want to generate your project on a different machine, you can simply run
git clone your_git_repo
and then
npm install.