Including Ramda in A Project

Following the instructions from Ramda's homepage, to install Ramda into a project via NPM, you run

λ npm i ramda

If you're building for the frontend and are using a build tool that has tree-shaking or dead-code elimination, then here is how you should import functions from Ramda:

import { compose, lensProp, map, over } from 'ramda'

However, if you do not have a build tool that does tree-shaking, you may want to import directly from the files you use to avoid importing the entire Ramda library when you only want to use a few functions. The two options with v0.27.1 are ESModules- and CommonJS-based.

// ESModules
import compose from 'ramda/es/compose'
import lensProp from 'ramda/es/lensProp'

// CommonJS
const compose = require('ramda/src/compose')
const lensProp = require('ramda/src/lensProp')