require() to import throws error: Cannot read property 'createsocket' of undefined
require() to import throws error: Cannot read property 'createsocket' of undefined
当我使用 require 时导入工作正常:
let dgram = require('react-native-udp')
但是当我尝试使用与导入相同的方法时:
import dgram from 'react-native-udp'
我收到错误:Cannot read property 'createsocket' of undefined
当我在 node_modules 中查看它的目录时,这就是我得到的:
我也试过:
import {dgram} from 'react-native-udp'
但是得到同样的错误
尝试:
import * as dgram from 'react-native-udp'
当我使用 require 时导入工作正常:
let dgram = require('react-native-udp')
但是当我尝试使用与导入相同的方法时:
import dgram from 'react-native-udp'
我收到错误:Cannot read property 'createsocket' of undefined
当我在 node_modules 中查看它的目录时,这就是我得到的:
我也试过:
import {dgram} from 'react-native-udp'
但是得到同样的错误
尝试:
import * as dgram from 'react-native-udp'