Upgrade Guide
When upgrading to a newer version of Turf, see the CHANGELOG and release notes for any breaking changes. If you are getting errors after upgrade, look to see if the API docs have changed for your functions between versions and migrate them as appropriate.
How you upgrade Turf will depend on your specific environment and tooling. Here are some guidelines to get you started.
The source of truth for published versions of Turf is NPM. You are welcome to use other providers that republish these packages.
In Node.js
# If you use the all-inclusive turf library
npm update --save @turf/turf
# if you use the smaller individual turf packages
npm update --save @turf/helpers @turf/buffer
As of v7, both CommonJS and ESM bundles are included.
In browser
Whether downloading locally, or including a 3rd party version of turf directly, there are multiple CDN's to choose from and each has a URL scheme that allows you to specify what version you want, with some flexibility. Structure your URL as appropriate for your needs:
- jsdelivr
- browse: https://www.jsdelivr.com/package/npm/@turf/turf
- latest within major version: https://cdn.jsdelivr.net/npm/@turf/turf@7/turf.min.js
- latest within minor version: https://cdn.jsdelivr.net/npm/@turf/[email protected]/turf.min.js
- specific version: https://cdn.jsdelivr.net/npm/@turf/[email protected]/turf.min.js
- unpkg
- browse: https://unpkg.com/browse/@turf/[email protected]/
- latest within major version: https://unpkg.com/@turf/turf@^7/turf.min.js
- latest within minor version: https://unpkg.com/@turf/turf@^7.0/turf.min.js
- specific version: https://unpkg.com/@turf/[email protected]/turf.min.js
Here's an example of migrating from Turf 6.x to 7.x
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js"></script>
becomes
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@7/turf.min.js"></script>
It is not recommended to use a CDN URL that always gives you the latest
bleeding edge version of Turf, especially in a production app. There are breaking changes to turf functions between major versions that can leave your app in a broken state.