Skip to content

Commit

Permalink
replace process.env.NODE_ENV references in browser build (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
cajames authored Sep 25, 2023
1 parent c424f3b commit 37c15df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"dependencies": {
"@0xsequence/abi": "^0.43.34",
"@0xsequence/config": "^0.43.34",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/contracts": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@ethersproject/wallet": "^5.7.0",
"@imtbl/core-sdk": "^2.0.2",
Expand All @@ -24,7 +27,8 @@
"enc-utils": "^3.0.0",
"ethers": "^5.7.2",
"magic-sdk": "^13.3.1",
"oidc-client-ts": "^2.2.1"
"oidc-client-ts": "^2.2.1",
"typechain": "^8.1.1"
},
"devDependencies": {
"@imtbl/blockchain-data": "0.0.0",
Expand Down
6 changes: 5 additions & 1 deletion sdk/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,13 @@ export default [
typescript(),
json(),
replace({
exclude: 'node_modules/**',
// Can't exclude node_modules here because some dependencies use process.env.NODE_ENV
// this breaks in browsers
preventAssignment: true,
__SDK_VERSION__: pkg.version,

// This breaks in a dex dependency, so manually replacing it.
'process.env.NODE_ENV': '"production"'
}),
terser(),
],
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3770,7 +3770,10 @@ __metadata:
dependencies:
"@0xsequence/abi": ^0.43.34
"@0xsequence/config": ^0.43.34
"@ethersproject/abi": ^5.7.0
"@ethersproject/abstract-signer": ^5.7.0
"@ethersproject/bignumber": ^5.7.0
"@ethersproject/contracts": ^5.7.0
"@ethersproject/providers": ^5.7.2
"@ethersproject/wallet": ^5.7.0
"@imtbl/blockchain-data": 0.0.0
Expand Down Expand Up @@ -3816,6 +3819,7 @@ __metadata:
rollup-plugin-dts: ^5.3.0
rollup-plugin-polyfill-node: ^0.12.0
semver: ^7.4.0
typechain: ^8.1.1
typescript: ^4.9.5
peerDependencies:
react: ^18.2.0
Expand Down

0 comments on commit 37c15df

Please sign in to comment.