dav icon indicating copy to clipboard operation
dav copied to clipboard

require() must have a single string literal argument / when using with React Native

Open edouardpagnier opened this issue 8 years ago • 1 comments

Hello,

I just try to use dav.js in a React Native (0.50) project, and I got the following error when loading the bundle: error: bundling failed: Error: require() must have a single string literal argument: ./node_modules/dav/dav.js:3156 at pushDependency (./node_modules/metro-bundler/src/JSTransformer/worker/extract-dependencies.js:44:13) at CallExpression (./node_modules/metro-bundler/src/JSTransformer/worker/extract-dependencies.js:59:9) at NodePath._call (./node_modules/babel-traverse/lib/path/context.js:76:18) at NodePath.call (./node_modules/babel-traverse/lib/path/context.js:48:17) at NodePath.visit (./node_modules/babel-traverse/lib/path/context.js:105:12) at TraversalContext.visitQueue (./node_modules/babel-traverse/lib/context.js:150:16) at TraversalContext.visitSingle (./node_modules/babel-traverse/lib/context.js:108:19) at TraversalContext.visit (./node_modules/babel-traverse/lib/context.js:192:19) at Function.traverse.node (./node_modules/babel-traverse/lib/index.js:114:17)

This issue happened on other lib as well when used with React Native, like real for example: https://github.com/realm/realm-js/issues/1342

Thanks

edouardpagnier avatar Dec 08 '17 21:12 edouardpagnier

I can confirm this is still an issue. The cause seems to be https://github.com/lambdabaa/dav/blob/master/lib/xmlhttprequest.js#L9. @lambdabaa is tricking browserify here really required? This line knocks out packagers like haste/metro

designtesbrot avatar Sep 15 '18 08:09 designtesbrot