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

v2.25: Cannot find module @uniswap/conedison/dist/format #404

Open
au2001 opened this issue Jan 14, 2023 · 14 comments
Open

v2.25: Cannot find module @uniswap/conedison/dist/format #404

au2001 opened this issue Jan 14, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@au2001
Copy link

au2001 commented Jan 14, 2023

Bug Description
Whenever I try to start or build my app, the following error is raised:

Error: Cannot find module '/app/node_modules/@uniswap/conedison/dist/format'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1016:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1009:15)
    at resolveExports (node:internal/modules/cjs/loader:529:14)
    at Module._findPath (node:internal/modules/cjs/loader:569:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:981:27)
    at mod._resolveFilename (/app/node_modules/next/dist/build/webpack/require-hook.js:23:32)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/app/node_modules/@uniswap/widgets/dist/cjs/index-48446dbf.cjs:66:14) {
  code: 'MODULE_NOT_FOUND',
  path: '/app/node_modules/@uniswap/conedison/package.json'
}

Steps to Reproduce

  1. Create a Next.js app
  2. Install @uniswap/widgets version 2.25.0 or higher
  3. Add the component to a page
  4. Start or build the app

Expected Behavior
The app should not throw an error.

Temporary Solution
Downgrading to version 2.24.0 solves this issue.

@au2001 au2001 added the bug Something isn't working label Jan 14, 2023
@zyrm
Copy link

zyrm commented Jan 16, 2023

Same

1 similar comment
@rharkor
Copy link

rharkor commented Jan 18, 2023

Same

@just-toby
Copy link
Collaborator

this is a known issue in our conedison number formatting library. until we can fix it on that side, you can try mapping the library like we do in our interface: https://github.com/Uniswap/interface/blob/main/craco.config.cjs#L42

@ZiggStardust
Copy link

@just-toby which is the stable version ? If we are waiting for the conedison number formatting library to update ?

@just-toby
Copy link
Collaborator

@ZiggStardust i don't think there's a breaking change in this repo - we've always remapped our imports of conedison as shown in the link above.

@houman-sanati
Copy link

@ZiggStardust vetsion 2.24.0 is working like a charm and is not missing any dependencies.

@au2001 au2001 changed the title v2.5: Cannot find module @uniswap/conedison/dist/format v2.25: Cannot find module @uniswap/conedison/dist/format Feb 12, 2023
@Tomiblanchard
Copy link

@ZiggStardust i don't think there's a breaking change in this repo - we've always remapped our imports of conedison as shown in the link above.

Here's what I tried for a NextJS app with version 2.25.0 or higher :

  1. yarn add @uniswap/widgets

  2. yarn dev

  3. Hit with a Server Error
    Error: Cannot find module '.../node_modules/@uniswap/conedison/dist/provider'

  4. Remapping in next.config.js as advised by @just-toby
    config.resolve.alias['@uniswap/conedison'] = '@uniswap/conedison/dist'

  5. Hit with a Module not found error

./node_modules/@uniswap/widgets/dist/clientSideSmartOrderRouter-3dbdcd6a.js:46:0
Module not found: Can't resolve '@uniswap/conedison/provider'

@marcinciarka
Copy link

Had luck with disabling SSR for that particular component with a dynamic component: https://blog.bitsrc.io/using-non-ssr-friendly-components-with-next-js-916f38e8992c

@misha256
Copy link

misha256 commented Mar 8, 2023

@marcinciarka like that?
const { SwapWidget, darkTheme, lightTheme } = dynamic(
() => import('@uniswap/widgets'),
{ ssr: false },
);

@victaphu
Copy link

Not sure if this will help, but I struggled with the dynamic imports until I did the following:

const SwapWidget = dynamic(
async() => {
const res = await import('@uniswap/widgets');
return res.SwapWidget;
},
{ssr: false}
)

I tried the above with what @misha256 mentioned but it threw an exception

@keirongulrajani
Copy link

this is a known issue in our conedison number formatting library. until we can fix it on that side, you can try mapping the library like we do in our interface: https://github.com/Uniswap/interface/blob/main/craco.config.cjs#L42

Following this advice in the resolve > alias part of my webpack config seems to have resolved the issue for me too:

....
module.exports = {
   ...
  resolve: {
    alias: {
      ...
      '@uniswap/conedison': '@uniswap/conedison/dist',
    }
  },

@ZowieTao
Copy link

info  - Collecting page data ...Error: Cannot find module '/Users/.../node_modules/@uniswap/conedison/dist/provider/signing'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1096:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1089:15)
    at resolveExports (node:internal/modules/cjs/loader:565:14)
    at Module._findPath (node:internal/modules/cjs/loader:634:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1061:27)
    at mod._resolveFilename (/Users/.../node_modules/next/dist/build/webpack/require-hook.js:23:32)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/.../node_modules/@uniswap/widgets/dist/cjs/index-4f48ae8b.cjs:47:15) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/.../node_modules/@uniswap/conedison/package.json'
}

> Build error occurred
Error: Failed to collect page data for /
    at /Users/.../node_modules/next/dist/build/utils.js:963:15 {
  type: 'Error'
}

widget version: 2.51.2

@celsosa
Copy link

celsosa commented Apr 28, 2023

info  - Collecting page data ...Error: Cannot find module '/Users/.../node_modules/@uniswap/conedison/dist/provider/signing'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1096:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1089:15)
    at resolveExports (node:internal/modules/cjs/loader:565:14)
    at Module._findPath (node:internal/modules/cjs/loader:634:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1061:27)
    at mod._resolveFilename (/Users/.../node_modules/next/dist/build/webpack/require-hook.js:23:32)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/.../node_modules/@uniswap/widgets/dist/cjs/index-4f48ae8b.cjs:47:15) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/.../node_modules/@uniswap/conedison/package.json'
}

> Build error occurred
Error: Failed to collect page data for /
    at /Users/.../node_modules/next/dist/build/utils.js:963:15 {
  type: 'Error'
}

widget version: 2.51.2

same error here

@WyattMufson
Copy link

Related issue #580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests