calvinmetcalf / crypto-pouch

plugin for encrypted pouchdb/couchdb databases
MIT License
243 stars 44 forks source link

Trying to use crypto-pouch with create-react-app #57

Closed kavaro closed 7 years ago

kavaro commented 7 years ago

I am trying to use crypto-pouch (3.1.1) in a create-react-app (webpack based) application. In development mode, everything works fine, but during a production build I get the following error:

Creating an optimized production build...
Failed to compile.

static/js/main.527d795f.js from UglifyJs
SyntaxError: Unexpected token: name (check) [./~/native-crypto/lib/decrypt.js:4,0]

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The error only occurs when crypto-pouch is required/imported by the app. To reproduce:

> npm install create-react-app -g
> create-react-app my-app
> cd my-app
> yarn add crypto-pouch --save

then add the following at the top of "my-app/src/index.js"

import crypto from "crypto-pouch";

Start a production build

yarn run build

And now an error is reported.

calvinmetcalf commented 7 years ago

ok fixed it in a dependency of this, so reinstall your deps (make sure to delete your yarn.lock)

kavaro commented 7 years ago

It works ... thanks for the great support and crypto-pouch in general !!!!