We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Using ReactJS and Vite, the project works well when running as develop mode. But when build for production, I got the error
[commonjs] Complex binding patterns require an initialization value (14:6) in /Users/locnguyen/Documents/demo-near/node_modules/@near-wallet-selector/core/index.esm.js file: /Users/locnguyen/Documents/demo-near/node_modules/@near-wallet-selector/core/index.esm.js:14:6 12: 13: // zloirock/core-js#86 (comment) 14: var global$I = ^ 15: // eslint-disable-next-line es/no-global-this -- safe 16: check(typeof globalThis == 'object' && globalThis) ||
To Reproduce I made a demo repository for reproducing here: https://github.com/phucloc8697/demo-near
yarn
yarn build
Expected behavior The build should complete successfully with no error from near-wallet-selector.
Screenshots
Device (please complete the following information):
The text was updated successfully, but these errors were encountered:
Hey @phucloc8697 , thanks for raising this issue!
After some investigation the issue seems to be caused by the global: {} property in vite.config.ts.
global: {}
vite.config.ts
To avoid getting build errors in this case you will need to change it slightly:
export default defineConfig({ plugins: [react()], define: { "global": "window", "process.env.NODE_DEBUG": JSON.stringify(""), }, })
As suggested here: daily-co/daily-js#163 (comment)
To demonstrate that build is working I have forked your repo and then published it in gh-pages:
Forked repo: https://github.com/kujtimprenkuSQA/demo-near Demo: https://kujtimprenkusqa.github.io/demo-near/
If you have any questions please let us know.
Sorry, something went wrong.
This worked for me. Thanks @kujtimprenkuSQA
No branches or pull requests
Describe the bug
Using ReactJS and Vite, the project works well when running as develop mode. But when build for production, I got the error
[commonjs] Complex binding patterns require an initialization value (14:6) in /Users/locnguyen/Documents/demo-near/node_modules/@near-wallet-selector/core/index.esm.js
file: /Users/locnguyen/Documents/demo-near/node_modules/@near-wallet-selector/core/index.esm.js:14:6
12:
13: // zloirock/core-js#86 (comment)
14: var global$I =
^
15: // eslint-disable-next-line es/no-global-this -- safe
16: check(typeof globalThis == 'object' && globalThis) ||
To Reproduce
I made a demo repository for reproducing here: https://github.com/phucloc8697/demo-near
yarn
andyarn build
Expected behavior
The build should complete successfully with no error from near-wallet-selector.
Screenshots
Device (please complete the following information):
The text was updated successfully, but these errors were encountered: