我的服务器 (node.js) 项目中有一个配置文件,需要在我的客户端中使用它(反应)
I have a confige file at my server (node.js) project and need to use it inside my client (react)
我的服务器 (node.js) 项目中有一个配置文件,需要在我的客户端中使用它 (react)。
但是当我使用直接导入 import keys from "../../../config/keys";
它说:
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/.
当我使用符号链接时,它说:
:/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'
@ILoveReactAndNode
只需将 config.js 文件复制到 src 文件夹内并更改导入密钥路径。
也请通过这些链接进行澄清:https://github.com/facebook/create-react-app/issues/834
我的服务器 (node.js) 项目中有一个配置文件,需要在我的客户端中使用它 (react)。
但是当我使用直接导入 import keys from "../../../config/keys";
它说:
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/.
当我使用符号链接时,它说:
:/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'
@ILoveReactAndNode
只需将 config.js 文件复制到 src 文件夹内并更改导入密钥路径。
也请通过这些链接进行澄清:https://github.com/facebook/create-react-app/issues/834