ssbc / ssb-keys

keyfile operations for ssb
36 stars 26 forks source link

SyntaxError in strict mode when importing into es6 #33

Closed gardner closed 7 years ago

gardner commented 7 years ago

node: v6.9.3 npm: 3.10.10

Trying to import ssb-keys into React Native.

npm install -g react-native-cli
git clone https://github.com/gardner/rnssb.git
cd rnssb
npm install
react-native run-android

simulator screen shot jan 26 2017 11 12 12 am

dominictarr commented 7 years ago

why are you exporting into strict mode? is that a react-native thing?

gardner commented 7 years ago

Yeah, react native uses the react-native preset. You can see the code here: https://github.com/facebook/react-native/blob/master/babel-preset/configs/main.js

It's weird because the react-native preset seems to turn off strict for commonjs modules: ['transform-es2015-modules-commonjs', { strict: false, allowTopLevelThis: true }],

I logged this issue here in case there's any future-proofing to be done on ssb-keys. Please close this issue if there is none. I'll keep iterating on a fix. It's probably a setting that recently changed in react-native. Thanks! ⛵⛵⛵

dominictarr commented 7 years ago

actually, this was a simple fix. ssb-keys@7.0.4 now uses strict mode!