Combines lodash and lodash-es packages.
npm install lodash-commonjs-es
Sample configuration to store CommonJS version in dist folder and ES2020 version in es folder:
// package.json
{
"main": "dist/index.js",
"module": "es/index.js",
"scripts": {
"build": "npm run build-commonjs && npm run build-es",
"build-commonjs": "tsc --project tsconfig-commonjs.json",
"build-es": "tsc --project tsconfig-es.json"
},
"dependencies": {
"lodash-commonjs-es": "^1.0.0"
}
}
// tsconfig-commonjs.json
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "CommonJS",
"outDir": "dist"
}
}
// tsconfig-es.json
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "ES2020",
"outDir": "es"
}
}