question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Project doesn't compile

See original GitHub issue

Describe the bug

I have a simple project with web3 libraries, but it doesn’t compile. Check this stackblitz

used web3 libraries

"@ethersproject/providers": "^5.5.1",
"@web3-react/core": "^6.0.9",
"@web3-react/injected-connector": "^6.0.7",
"@web3-react/network-connector": "^6.1.9",

Reproduction

Check this stackblitz

System Info

System:
    OS: macOS 12.0.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 184.80 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.2.0 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.2.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 96.0.4664.55
    Firefox: 94.0.2
    Safari: 15.1
  npmPackages:
    @vitejs/plugin-react: ^1.0.0 => 1.1.0 
    vite: ^2.6.4 => 2.6.14

Used Package Manager

yarn

Logs

vite build --debug 
  vite:config bundled config file loaded in 103.49ms +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  vite:config     'alias',
  vite:config     'vite:react-babel',
  vite:config     'vite:react-refresh',
  vite:config     'vite:react-jsx',
  vite:config     'vite:modulepreload-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html-inline-script-proxy',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:build-html',
  vite:config     'commonjs',
  vite:config     'vite:data-uri',
  vite:config     'rollup-plugin-dynamic-import-variables',
  vite:config     'vite:asset-import-meta-url',
  vite:config     'vite:build-import-analysis',
  vite:config     'vite:esbuild-transpile',
  vite:config     'vite:reporter',
  vite:config     'vite:load-fallback'
  vite:config   ],
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     polyfillModulePreload: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     cssTarget: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  vite:config     minify: 'esbuild',
  vite:config     terserOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     reportCompressedSize: true,
  vite:config     chunkSizeWarningLimit: 500,
  vite:config     watch: null,
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] }
  vite:config   },
  vite:config   resolve: { dedupe: [ 'react', 'react-dom' ], alias: [ [Object], [Object] ] },
  vite:config   optimizeDeps: {
  vite:config     include: [ 'react/jsx-dev-runtime' ],
  vite:config     esbuildOptions: { keepNames: undefined, preserveSymlinks: undefined }
  vite:config   },
  vite:config   configFile: '/Users/andrejgajdos/dev/syndicate/vite.config.js',
  vite:config   configFileDependencies: [ 'vite.config.js' ],
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     mode: undefined,
  vite:config     configFile: undefined,
  vite:config     logLevel: undefined,
  vite:config     clearScreen: undefined,
  vite:config     build: {}
  vite:config   },
  vite:config   root: '/Users/andrejgajdos/dev/syndicate',
  vite:config   base: '/',
  vite:config   publicDir: '/Users/andrejgajdos/dev/syndicate/public',
  vite:config   cacheDir: '/Users/andrejgajdos/dev/syndicate/node_modules/.vite',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  vite:config   server: { fs: { strict: undefined, allow: [Array] } },
  vite:config   env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     warnOnce: [Function: warnOnce],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen],
  vite:config     hasErrorLogged: [Function: hasErrorLogged]
  vite:config   },
  vite:config   createResolver: [Function: createResolver]
  vite:config } +2ms
vite v2.6.14 building for production...
✓ 149 modules transformed.
'EventEmitter' is not exported by __vite-browser-external, imported by node_modules/@web3-react/abstract-connector/dist/abstract-connector.esm.js
file: /Users/andrejgajdos/dev/syndicate/node_modules/@web3-react/abstract-connector/dist/abstract-connector.esm.js:1:9
1: import { EventEmitter } from 'events';
            ^
2: import { ConnectorEvent } from '@web3-react/types';
error during build:
Error: 'EventEmitter' is not exported by __vite-browser-external, imported by node_modules/@web3-react/abstract-connector/dist/abstract-connector.esm.js
    at error (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:158:30)
    at Module.error (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:12382:16)
    at Module.traceVariable (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:12767:29)
    at ModuleScope.findVariable (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:11559:39)
    at Identifier.bind (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:6419:40)
    at CallExpression.bind (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:5021:31)
    at CallExpression.bind (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:9396:15)
    at VariableDeclarator.bind (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:5025:23)
    at VariableDeclaration.bind (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:5021:31)
    at Program.bind (/opt/homebrew/lib/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:5021:31)


### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Niputicommented, Dec 7, 2021

that’s because create react is unfortunately polyfilling node builtins. I can take a look at your repo when I get home from work

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio solution doesn't compile, but project does
However, when I build the project, it compiles fine. Once I build the project then a solution build doesn't throw any errors.
Read more >
Run does not compile project anymore - Visual Studio Feedback
In Visual Studio for Mac 8.7 (Community) Build 2037, the following scenario occurs 1. Open a Solution (mine has around 10 subprojects, (....
Read more >
5 Debugging Tips for a Solution that Won't Compile
Investigate Reference Paths ... One of the two most common reasons why a project cannot compile is because a referenced library cannot be...
Read more >
Project doesn`t compile
Hi Guys, I'd like to make changes to a program, but have a problem compiling the source code. I have downloaded and installed...
Read more >
Visual Studio 2019 sometimes won't compile/link in new ...
I'm using Visual Studio 2019 Professional (version 16.7.7+30621.155), and when I'm compiling a big C++ DLL project (incl. our own static ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found