antfu / local-pkg Goto Github PK
View Code? Open in Web Editor NEWGet information on local packages.
License: MIT License
Get information on local packages.
License: MIT License
Tried using this on Node 12.16.3
but I got the engine error.
I had to use has-pkg which serves for what I want to achieve and has no engine limitation.
Is there a specific reason why the engine required is node >=14?
No matching export in "browser-external:fs" for import "existsSync"
I'm trying to use Vitest and I'm running into an issue with Yarn PnP:
.pnp.cjs:101340 Uncaught Error: local-pkg tried to access vite, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: vite (via "vite/package.json")
Required by: local-pkg@npm:0.4.0 (via /Users/minh/dev/project/.yarn/cache/local-pkg-npm-0.4.0-c31827f33b-46964cea4b.zip/node_modules/local-pkg/)
I believe that this package needs to support basedir
(similar to resolve
), and set the paths
option of require.resolve
:
https://github.com/antfu/local-pkg/blob/fc9d06c5a43485d83f41ec35dfc842e1f6d45aa5/index.mjs#L51-L65
I'm not sure which repo is ultimately responsible for this issue, so let me report this here.
I suddenly started running into TypeError: coverageModule.getProvider is not a function
when trying to generate coverage with vitest. Let me just skip straight to the investigation results.
It seems like importModule
only considers an import to be ESM if the exported object has a truthy __esModule
property. Reference: https://github.com/antfu/local-pkg/blob/main/index.mjs#L20
When I look at the code and dumped the module object during debugging, the module object was found, but the default export doesn't have that property. Reference: https://unpkg.com/browse/@vitest/[email protected]/dist/index.js
After downgrading @vitest/coverage-c8
to 0.29.7 it works again.
I hope my explanation is enough.
System:
OS: macOS 12.6.2
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 20.13 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.15.0 - ~/.asdf/installs/nodejs/18.15.0/bin/node
npm: 9.5.0 - ~/.asdf/plugins/nodejs/shims/npm
Browsers:
Chrome: 111.0.5563.146
Firefox: 111.0.1
Safari: 16.3
Safari Technology Preview: 16.4
pnpm
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.