Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fauna webpack config #550

Merged
merged 1 commit into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,13 @@ Production vars should be set in Github Actions secrets.
## S3 Setup

We use [S3](https://aws.amazon.com/s3/) for backup and disaster recovery. For production an account on AWS needs to be created.

## Local DB Setup

Inside the `/packages/api` folder create a file called `.env.local` with the following content.

```ini
DATABASE=<name> # either "fauna" or "postgres"
```

Production vars should be set in Github Actions secrets.
15 changes: 10 additions & 5 deletions packages/api/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ const require = createRequire(__dirname)
// see: https://docs.sentry.io/platforms/javascript/guides/cordova/configuration/releases/
const SENTRY_RELEASE = `web3-api@${process.env.npm_package_version}`

const alias = {
// node-fetch and cross-fetch causes TypeError: Illegal invocation in Cloudflare Workers
'node-fetch': path.resolve(__dirname, 'src', 'utils', 'fetch.js')
}

if (process.env.DATABASE === 'postgres') {
alias['cross-fetch'] = path.resolve(__dirname, 'src', 'utils', 'fetch.js')
}

export default {
target: 'webworker',
mode: 'development',
Expand Down Expand Up @@ -75,11 +84,7 @@ export default {
fallback: {
stream: require.resolve('stream-browserify')
},
alias: {
// node-fetch and cross-fetch causes TypeError: Illegal invocation in Cloudflare Workers
'node-fetch': path.resolve(__dirname, 'src', 'utils', 'fetch.js'),
'cross-fetch': path.resolve(__dirname, 'src', 'utils', 'fetch.js')
}
alias
},
optimization: {
minimize: true,
Expand Down