medikoo / memoizee

Complete memoize/cache solution for JavaScript
ISC License
1.73k stars 61 forks source link

Cannot import memoizee #124

Closed valerii15298 closed 2 years ago

valerii15298 commented 3 years ago

Hello, i am trying to use memoizee in my project but i simply cannot import it. All other libraries work perfect. im trying import it using: import * as memoizee from "memoizee"; As i understand it does not work because one dir is named '#' => Similar issue

Logs: `

node_modules/.pnpm/memoizee@0.4.15/node_modules/memoizee/normalizers/get-1.js:3:22: error: Could not read from file: C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.p npm\es5-ext@0.10.53\node_modules\es5-ext\array\index.js#\e-index-of 3 │ var indexOf = require("es5-ext/array/#/e-index-of"); ╵ ~~~~~~~~

node_modules/.pnpm/d@1.0.1/node_modules/d/index.js:7:30: error: Could not read from file: C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\es5-ext@0.10.53\node_mo dules\es5-ext\string\index.js#\contains 7 │ , contains = require("es5-ext/string/#/contains"); ╵ ~~~~~~~

error when starting dev server: Error: Build failed with 2 errors: node_modules/.pnpm/d@1.0.1/node_modules/d/index.js:7:30: error: Could not read from file: C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\es5-ext@0.10.53\node_modul es\es5-ext\string\index.js#\contains node_modules/.pnpm/memoizee@0.4.15/node_modules/memoizee/normalizers/get-1.js:3:22: error: Could not read from file: C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm \es5-ext@0.10.53\node_modules\es5-ext\array\index.js#\e-index-of at failureErrorWithLog (C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\esbuild@0.12.24\node_modules\esbuild\lib\main.js:1451:15) at C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\esbuild@0.12.24\node_modules\esbuild\lib\main.js:1131:28 at runOnEndCallbacks (C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\esbuild@0.12.24\node_modules\esbuild\lib\main.js:921:63) at buildResponseToResult (C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\esbuild@0.12.24\node_modules\esbuild\lib\main.js:1129:7) at C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\esbuild@0.12.24\node_modules\esbuild\lib\main.js:1238:14 at C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\esbuild@0.12.24\node_modules\esbuild\lib\main.js:609:9 at handleIncomingPacket (C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\esbuild@0.12.24\node_modules\esbuild\lib\main.js:706:9) at Socket.readFromStdout (C:\Users\valer\OneDrive\Desktop\projects\drawflow-vite\node_modules.pnpm\esbuild@0.12.24\node_modules\esbuild\lib\main.js:576:7) at Socket.emit (events.js:315:20) at Socket.EventEmitter.emit (domain.js:467:12)  ERROR  Command failed with exit code 1.

`

medikoo commented 3 years ago

@valerii15298 At some point I plan to migrate internals from es5-ext to ext (so problematic for some tools, paths that include # are no longer in play). Still ETA is unknown.

Also note that per standards there's nothing wrong with memoizee. require works with fs paths resolution and # is totally valid char in name of every FS I'm aware of.

Technically it's an issue (limitation) in some of the tools in your setup, and best if it's reported over in their bug trackers

ahrjarrett commented 2 years ago

I don't know enough about ESBuild to say this definitively, but when I try to use memoizee in a program bundled by ESBuild, this bug crashes my application.

Not sure if this is because ESBuild chokes on # characters in filenames, or if this is something that is configurable inside ESBuild. I just know that I don't have time to investigate, and will have to replace memoizee with another memoization package at work (since we're gradually moving to ESBuild).

If someone knows a fix, I'd love to hear, otherwise it looks like this is a dealbreaker for us.

medikoo commented 2 years ago

@ahrjarrett have you considered reporting the issue to ESBuild?