Skip to content

Vite + Nuxt3 #1645

@SpiritusDeos

Description

@SpiritusDeos

Current Behavior

Using the currently configuration on the web3-onboard website for Vite + Nuxt, I have this following issue:

Screen Shot 2023-04-17 at 22 37 03

Expected Behavior

I would like to make wallet connect works with Nuxt3 + Vite

Steps To Reproduce

Create a Nuxt (3.3.3) project and set into the vite object (nuxt.config.ts), this following configuration:

 vite: { plugins: [ development && nodePolyfills({ include: ['node_modules/**/*.js', new RegExp('node_modules/.vite/.*js')], http: true, crypto: true }) ], resolve: { alias: { crypto: 'crypto-browserify', stream: 'stream-browserify', assert: 'assert' } }, build: { minify: 'esbuild', target: 'esnext', rollupOptions: { plugins: [nodePolyfills({ crypto: true, http: true })] }, commonjsOptions: { transformMixedEsModules: true } } }, 

What package is effected by this issue?

@web3-onboard/core

Is this a build or a runtime issue?

Build

Package Version

2.6.2

Node Version

16.13

What browsers are you seeing the problem on?

Chrome

Relevant log output

✘ [ERROR] Could not read from file: /Users/xx/Desktop/[...]/crypto-browserify node_modules/rollup-plugin-polyfill-node/dist/es/index.js:4:28: 4 │ import { randomBytes } from 'crypto'; ╵ ~~~~~~~~ ERROR error while updating dependencies: 22:40:06 Error: Build failed with 1 error: node_modules/rollup-plugin-polyfill-node/dist/es/index.js:4:28: ERROR: Could not read from file: /Users/xx/Desktop/[...]/crypto-browserify at failureErrorWithLog (/Users/xx/Desktop/[...]/node_modules/esbuild/lib/main.js:1636:15) at /Users/xx/Desktop/[...]/node_modules/esbuild/lib/main.js:1048:25 at runOnEndCallbacks (/Users/xx/Desktop/[...]/node_modules/esbuild/lib/main.js:1471:45) at buildResponseToResult (/Users/xx/Desktop/[...]/node_modules/esbuild/lib/main.js:1046:7) at /Users/xx/Desktop/[...]/node_modules/esbuild/lib/main.js:1058:9 at new Promise (<anonymous>) at requestCallbacks.on-end (/Users/xx/Desktop/[...]/node_modules/esbuild/lib/main.js:1057:54) at handleRequest (/Users/xx/Desktop/[...]/node_modules/esbuild/lib/main.js:723:19) at handleIncomingPacket (/Users/xx/Desktop/[...]/node_modules/esbuild/lib/main.js:745:7) at Socket.readFromStdout (/Users/xx/Desktop/[...]/node_modules/esbuild/lib/main.js:673:7) 

Anything else?

No response

Sanity Check

  • If this is a build issue, I have included my build config. If this is a runtime issue, I have included reproduction steps and/or a Minimal, Reproducible Example.

Metadata

Metadata

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions