-
Notifications
You must be signed in to change notification settings - Fork 68
The package at "node_modules/react-native-dotenv/index.js" attempted to import the Node standard library module "path" #67
Comments
Same problem. The package appears to be broken. This is supposed to work as a babel plugin, so it's only ever run on the development machine, and using the Node.js standard lib is no problem in this case. The way the plugin works is it replaces references to itself within the project (i.e. I'm not sure how to fix it though. Babel is bewildering to me. |
So, I was giving it some more thought and .. what's the difference between react-native-dotenv and just having an .env (in json format) that you can import .env {
apiKey: 'lorem',
anotherConfig: 'foobar',
someConfig: false,
} then import env from './.env'
//env = {
// apiKey: 'lorem',
// anotherConfig: 'foobar',
// someConfig: false,
//} You can get fancy and create separate prod/dev keys, if you want |
Sure, you can do that. But the problem is that the build toolchain doesn't support dynamic imports, so if I want to have multiple In general I find it rather remarkable that react-native doesn't have official support and recommandations for this kind of essential configuration management.... |
I have fixed it by installing the missing path package. I hope somebody gets a better solution and let us know. File Structure:
My
|
I had the same problem for my expo project and clearing the npm cache helped.
My
|
Anything worked for me: |
There's a new repo and package babel-plugin-dotenv-import. |
While building the js bundle I get:
The package at "node_modules/react-native-dotenv/index.js" attempted to import the Node standard library module "path". It failed because React Native does not include the Node standard library. Read more at https://docs.expo.io/versions/latest/introduction/faq/#can-i-use-nodejs-packages-with-expo
My versions:
node: 10.16
npm: 6.9
expo: 32.0.6
react-native-dotenv: 0.2.0
I've tried to remove node_modules, cleared cache, restarting the computer, install again.
I have the same problem as the stackoverflow question.
This is my babel.config.js:
The text was updated successfully, but these errors were encountered: