-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing from TypeScript fails (because of problem with exports
field?)
#268
Comments
Hi @joliss, please install the latest version of memoize-fs, which is currently 3.0.2, then add |
Hm, the importing works now, but I'm noticing that calls into Node modules like return checkOptions(allOptions), await initCache((void 0)(allOptions.cachePath, allOptions.cacheId), allOptions), function() { The corresponding source is checkOptions(allOptions)
await initCache(
path.join(allOptions.cachePath, allOptions.cacheId),
allOptions
)
return function () { I'm seeing the following warning when running
The linked document doesn't show any way to disable this behavior, so perhaps it's just not really possible to build Node library code with Vite. Thanks for your patience -- I wish I knew more about the intricacies of Node's module handling to be more helpful. |
I'm also wondering if it isn't possible to make memoize-fs importable from TypeScript without adding |
Looks like setting |
I'm having trouble importing memoize-fs using TypeScript, and I've been struggling for the past hour to figure out why it's failing. I made a minimal test case at https://github.com/joliss/import-problem so you can run it yourself if you like.
I have the following
index.ts
:TypeScript can't find the import (both with
tsc
and in VS Code), even thoughmemoize-fs
is clearly installed:tsc
nonetheless produces a compiledindex.js
file. If I run it, I get the following error from Node's module resolver:I can see the following
exports
declaration in thepackage.json
:The
dist/index.d.ts
anddist/index.mjs
files do exist in the distribution.I'm not sure why exactly the
exports
field isn't being picked up properly by Node.I'm running the latest stable Node and TypeScript versions:
For what it's worth, my actual workflow doesn't involve transpiling with
tsc
but rather running with ts-node, but it's showing the same error (ts-node index.ts
andts-node --transpile-only index.ts
).The text was updated successfully, but these errors were encountered: