1
votes

I have a confige file at my server (node.js) project and need to use it inside my client (react). But when I uset direct import import keys from "../../../config/keys"; it says:

module not found: You attempted to import ../../../config/keys which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.

and when I use symlink it says:

:/Users/FEPCT79/AppData/Roaming/npm/node_modules/keys/lib/stores/nstore.js Module not found: Can't resolve 'nstore' in 'C:\Users\FEPCT79\AppData\Roaming\npm\node_modules\keys\lib\stores'

1

1 Answers

1
votes

@ILoveReactAndNode

Simply do copy of your config.js file to inside of src folder and change your import keys path.

Also once go through these links for clarification : https://github.com/facebook/create-react-app/issues/834

https://stackoverflow.com/a/44115058/9333951