const webpack = require('webpack');

module.exports = {
resolve:{fallback: { "crypto": require.resolve("crypto-browserify"),
                     "stream": require.resolve("stream-browserify"),
                     "buffer": require.resolve("buffer-browserify"),
                     "path": require.resolve("path-browserify"),
                     "assert": require.resolve("assert/")}},
module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env", "@babel/preset-react"],
            }
        }

      }
    ]
  },
     plugins: [
        new webpack.ProvidePlugin({
            process: 'process/browser',
            'process.env.POUCHDB_NAME': JSON.stringify(process.env.POUCHDB_NAME || 'mydb'),
        })
    ],
}