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

Building Next 14+ project blocked by turf - webpack #2535

Closed
darenmalfait opened this issue Nov 10, 2023 · 8 comments
Closed

Building Next 14+ project blocked by turf - webpack #2535

darenmalfait opened this issue Nov 10, 2023 · 8 comments
Assignees
Labels
bundling Anything related to issues with bundling @turf/buffer
Milestone

Comments

@darenmalfait
Copy link

Please provide the following when reporting an issue:

  • The version of Turf you are using, and any other relevant versions.
    6.5.0 + 7.0.0-alpha.2
  • GeoJSON data as a gist file or geojson.io (filename extension must be .geojson).
    not relevant
  • Snippet of source code or for complex examples use jsfiddle.
    not relevant

In development mode, everything works fine (also did in < NextJS 14 versions). It's webpack related.

../../node_modules/@turf/turf/node_modules/@turf/buffer/dist/es/index.js + 62 modules
Cannot get final name for export 'merge' of ../../node_modules/d3-geo/node_modules/d3-array/src/index.
> Build failed because of webpack errors
   Creating an optimized production build
@smallsaucepan smallsaucepan added bundling Anything related to issues with bundling @turf/buffer labels Dec 9, 2023
@smallsaucepan smallsaucepan added this to the v7 milestone Dec 15, 2023
@smallsaucepan smallsaucepan self-assigned this Dec 15, 2023
@smallsaucepan
Copy link
Member

Possible workaround here @darenmalfait Let us know if that helps.

@smallsaucepan smallsaucepan removed this from the v7 milestone Dec 17, 2023
@bernatfortet
Copy link

Same issue here. @darenmalfait did you figure out a workaround?

@smallsaucepan I've tried that workaround, I'm trying with serverComponentsExternalPackages: ['d3-array', '@turf/buffer'], but I can't figure it out.

@sebaterrazas
Copy link

sebaterrazas commented Feb 6, 2024

@bernatfortet it's not a great solution, but I solved my problem just by installing the modules I am using and its dependancies. So, avoid installing the whole @turf/turf library.

P.S: Maybe the problem could be solved just by importing the essential modules, and still installing the whole library, but I didn't tried that.

@darenmalfait
Copy link
Author

Adding @turf/buffer to serverComponentsExternalPackages does seem to work for me. Although I cannot 100% confirm, I had other priorities and the project I am using it in has other issues that needs solving.

My experimental config

experimental: {
    serverActions: {
      bodySizeLimit: '2mb',
    },
    serverComponentsExternalPackages: ['@turf/buffer'],
    esmExternals: 'loose',
  },

@bernatfortet
Copy link

Hi all, my issue was solved after upgrading to turf 7.0.0-alpha.2

@smallsaucepan
Copy link
Member

Hi @bernatfortet and @darenmalfait. Just released a new alpha that changes our packaging approach somewhat. Would you mind checking to make sure it isn't a step backwards for you? 7.0.0-alpha.114

@bernatfortet
Copy link

So far 114 works on dev, deploys to Vercel, and works on prod.
If I find any issues I'll let you know.

@smallsaucepan
Copy link
Member

Thanks @bernatfortet Will mark this resolved for now and include something in the 7.0.0 release notes to that effect.

@smallsaucepan smallsaucepan added this to the 7.0.0 milestone Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bundling Anything related to issues with bundling @turf/buffer
Projects
None yet
Development

No branches or pull requests

4 participants