Skip to content

feat: A naive replacement of both lodash methods.#156

Open
miccheng wants to merge 2 commits intomithunsatheesh:mainfrom
miccheng:remove-lodash
Open

feat: A naive replacement of both lodash methods.#156
miccheng wants to merge 2 commits intomithunsatheesh:mainfrom
miccheng:remove-lodash

Conversation

@miccheng
Copy link

@miccheng miccheng commented Mar 8, 2026

A naive implementation of removing the 2 lodash functions.

Initially tried to use the ES-Toolkit to replace the functions but ran into TSConfig issues. First i needed to change the moduleResolution to node, which caused issues with RollUp's commonjs plugin:

dist/index.js → dist/node-rules.min.js...
[!] (plugin commonjs--resolver) SyntaxError: Unexpected token (19:20) in /home/miccheng/projects/node-rules/node_modules/es-toolkit/dist/compat/predicate/isNative.js
dist/index.js (19:20)
    at Parser.pp$4.raise (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:2757:13)
    at Parser.pp.unexpected (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:647:8)
    at Parser.pp$3.parseExprAtom (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:2196:10)
    at Parser.pp$3.parseExprSubscripts (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:2047:19)
    at Parser.pp$3.parseMaybeUnary (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:2024:17)
    at Parser.pp$3.parseExprOps (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:1966:19)
    at Parser.pp$3.parseMaybeConditional (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:1949:19)
    at Parser.pp$3.parseMaybeAssign (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:1925:19)
    at Parser.pp$3.parseMaybeConditional (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:1954:28)
    at Parser.pp$3.parseMaybeAssign (/home/miccheng/projects/node-rules/node_modules/rollup-plugin-node-globals/node_modules/acorn/dist/acorn.js:1925:19)

Anyway, just tot I would create a PR just to get some inputs.

Update:

I tried using ES-Toolkit again and just exclude that module from the CommonJS RolUp plugin (solution is based on this StackOverflow post.

Exclude the problematic file/package from the CommonJS plugin:

The CommonJS plugin is designed to convert CommonJS modules to ES modules. If a dependency is already in ES module format (which es-toolkit likely is, given the error), it should be excluded from processing by the CommonJS plugin.

miccheng added 2 commits March 8, 2026 09:43
- Change moduleResolution to node.
- Fix RollUp issue by excluding the problematic module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant