Closed hugoattal closed 2 years ago
This seems to be a common issue: https://github.com/nodejs/node/issues/31710
Which is solved by using the url.pathToFileURL
function (example with vue-cli: https://github.com/vuejs/vue-cli/pull/6869/files)
It might be the same kind of issue in peeky?
Aaaah people reported the same bug in the end of this issue: https://github.com/Akryum/peeky/issues/2 I'm not the only one 😅
I wonder if this function is right: https://github.com/Akryum/peeky/blob/34826cbd1a2c3beba65b13de44cbda6532c6512a/packages/peeky-utils/src/fs.ts#L5
Shouldn't this be something like that?
const path = require('path')
const URL = require('url')
export function fixWindowsAbsoluteFileUrl (path: string) {
return path.isAbsolute ? URL.pathToFileURL(path).href : path;
// or just return URL.pathToFileURL(path).href ?
}
I'll try to setup the project to see if that fixes it.
EDIT: Annnnd, the scripts use the "&&" symbol which does not work on Windows 😩... Seems like I'll have to install WSL...
EDIT2: I don't understand, it works perfectly with the example from your repo. I'll try to create a minimum example...
EDIT3: OKAY! It may have to do with npm
! When I install the dependencies of the demo with npm install
I get the error, but if I use pnpm install
everything work! Think is, I also use storybook which is kinda broken with pnpm
...
In the end, it works with PNPM 🥳 !
pnpm import
to import your package-lock from npm
node_modules
folder and package-lock.json
filepnpm install
and you're ready to go!Only thing is that my storybook installation is now broken (it doesn't work with pnpm and vite), maybe for the best...
Would you mind sharing a minimal reproduction on GH with npm?
The demo here does not work with npm: https://github.com/Akryum/peeky/tree/master/examples/demo
But I'll create a minimal reproduction, give me 10 minutes!
@Akryum Here it is: https://github.com/hugoattal/peeky-bug-reproduction
npm install
npm run test
Also happens with yarn btw
Hey! So I'm trying to set up Peeky for my current project.
I'm on Windows 11 with:
The project works with
vite dev
andvite build
. Jest and Vitest works flawlessly. But in the same project, when I launchpeeky test
I get this error:It seems to be triggered when I import lodash (and lodash probably import some other thing with an absolute path)
I'm still not quite sure if it's a Peeky bug, a Vite bug, or just me forgetting to update some configuration, but I can't find anything on that ESM Loader...
Here is my
vite.config.ts
file if it helps: