Reputation: 935
Trying to upgrade my rn project to react native : 0.49.0-rc.5 and enzyme 3, all the tests works fine but babel throws transformation errors when running the packager.
bundling failed: Error: require() must have a single string literal argument
Regarding the stack :
"react": "^16.0.0-beta.5",
"react-native": "^0.49.0-rc.5",
"enzyme": "^3.0.0"
And
Node : 8.5
Upvotes: 3
Views: 760
Reputation: 935
With React 0.49.0-rc.5, they have updated the metro bundler which does not support dynamic imports as in require('./locale/' + name);
can no longer work and would throw error while bundling.
Most of the packages which does this kind of dynamic imports have fixed their code for the latest react native EX: Realm (https://github.com/facebook/react-native/issues/6391) and in my case it was moment.js which does dynamic imports and they need to fix this.
Upvotes: 4