opensea-js icon indicating copy to clipboard operation
opensea-js copied to clipboard

Next.js build Errors in 4.0.3

Open SMLaursen opened this issue 4 years ago • 7 comments

yarn 3.2.1 node 16.15.1 npm 8.11.0

After upgrading to [email protected] from 4.0.1 In my Next.js project, I got the following build errors;

Failed` to compile.

../node_modules/opensea-js/lib/sdk.js
Module not found: Can't resolve 'wyvern-schemas' in 'C:\Users\sunela\workspace\nft-poc\node_modules\opensea-js\lib'

Import trace for requested module:
../node_modules/opensea-js/lib/index.js
./src/pages/buyopensea/[...query].tsx

../node_modules/opensea-js/lib/utils/schema.js
Module not found: Can't resolve 'wyvern-schemas/dist/types' in 'C:\Users\sunela\workspace\nft-poc\node_modules\opensea-js\lib\utils'

Import trace for requested module:
../node_modules/opensea-js/lib/index.js
./src/pages/buyopensea/[...query].tsx

../node_modules/opensea-js/lib/utils/schema.js
Module not found: Can't resolve 'wyvern-schemas' in 'C:\Users\sunela\workspace\nft-poc\node_modules\opensea-js\lib\utils'

Import trace for requested module:
../node_modules/opensea-js/lib/index.js
./src/pages/buyopensea/[...query].tsx

../node_modules/opensea-js/lib/utils/utils.js
Module not found: Can't resolve 'wyvern-schemas/dist/types' in 'C:\Users\sunela\workspace\nft-poc\node_modules\opensea-js\lib\utils'

Import trace for requested module:
./src/pages/buyopensea/[...query].tsx


> Build failed because of webpack errors

SMLaursen avatar Jun 22 '22 20:06 SMLaursen

Hey @SMLaursen can you provide some details on your build process and webpack config?

jtaaa avatar Jun 22 '22 23:06 jtaaa

I realize this may be due to some Next.js configuration, and renamed the issue to reflect this.

My build process is simply just calling next build - not entirely sure what it entails but it have worked up until 4.0.3.

My webpack config is defined by NextConfig and due to #421, the addition of

  webpack: (config, {}) => {
    config.resolve.fallback = {
      ...config.resolve.fallback,
      fs: false,
    }
    return config
  },

Let me know if you need any other information

yarn 3.2.1 node 16.15.1 npm 8.11.0 next 12.0.8

SMLaursen avatar Jun 23 '22 06:06 SMLaursen

Same issue on my project.

vladopaets avatar Jun 23 '22 07:06 vladopaets

@SMLaursen thanks. I was able to reproduce. Adding this yarn resolution to your package.json should fix the issue:

  "resolutions": {
    "@0x/utils": "https://github.com/ProjectOpensea/0x-tools/raw/provider-patch/utils/0x-utils-6.5.0.tgz"
  }

Let me know if that works.

jtaaa avatar Jun 23 '22 17:06 jtaaa

Thanks for the quick reply, I was already using that workaround to avoid getting provider-related errors when validating wyvern orders.

Unfortunately this doesn't fix my build issues introduced with 4.0.3

SMLaursen avatar Jun 23 '22 19:06 SMLaursen

@SMLaursen I was having the exact same error message and I fixed it with:

  "resolutions": {
    "wyvern-schemas": "github:ProjectOpenSea/wyvern-schemas#b829f3e93b0332f280f547875b31a9a3c7ae092a"
  }

I'm using yarn v3 and for some reason when installing wyvern-schemas using any commit after this one generates an empty "wyvern-schemas" package with only LICENSE, package.json files.

latest commit works fine in yarn v1, but I can't return to yarn v1 here.

danizord avatar Jun 30 '22 02:06 danizord

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

github-actions[bot] avatar May 24 '23 04:05 github-actions[bot]