Open lishaduck opened 1 month ago
@lishaduck Ideally this should be a pacakge! And people would do:
// pnpmfile.cjs
const { withNolyfill } = require('pnpmfile-nolyfill');
module.exports = withNolyfill({
hooks: {},
});
...instead of copy-pasting!
I thought about that, but how would you install it if its part of the resolver?
I believe you should be able to use pre-existing modules while you're re-installing the repo?
I believe you should be able to use pre-existing modules while you're re-installing the repo?
Yes, you could, but on the initial install, it'd crash. In an ideal world, pnpm would just support inline script metadata (from python), but as it stands, you can't (a) run a clean install (i.e., in ci), or (b) reinstall from scratch (think the bootstrap problem).
I guess one option would be requiring to install it as a global dependency first, then as a local one, but that prevents SemVer majors 🤷♂️
I just found this really old comment. I'm going to try it tomorrow,[^1] and if it works, I'll publish pnpmfile-nolyfill
.
[^1]: Probably, gotta finish watching ViteConf 🙃
Hello! I wanted to use nolyfill in a pnpm project, so I went ahead and wrote a pnpmfile for nolyfilling pnpm dependencies. Plenty of credit (and thanks) to @wojtekmaj for
yarn-plugin-nolyfill
(and the phrasing for this issue 😜), on which I based my initial implementation (though pnpm's primitives are very different, so the 10 lines that matter ended up pretty different).How to use:
.pnpmfile.cjs
into your project.pnpm i
.You're more than welcome to try it out and let me know what you think.
The source code is at
github:lishaduck/pnpmfile-nolyfill
.Yay, I got issue 100 🥳 🙃