Building Next 14+ project blocked by turf - webpack
darenmalfait opened this issue · comments
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
Possible workaround here @darenmalfait Let us know if that helps.
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.
@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.
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',
},
Hi all, my issue was solved after upgrading to turf 7.0.0-alpha.2