Closed kecrily closed 2 years ago
Thanks for reporting!
Definitely Windows-specific, as the path is incorrectly resolved against the drive root, instead of the src dir.
PRs are welcome, but I'll take a look during the week.
This can probably help mitigate Windows issues: https://github.com/unjs/pathe
The strange thing is that one component has no problem and the other has a
problem. You can try deleting <List />
from index.mdx
and everything
works fine again. It's so weird.
The second error seems to be happening because meta
is empty here, causing filename
to be undefined, which results in the invalid import('/undefined')
.
The cause is probably the first file not found
error above, just taking note because I'd like to bubble up errors in frontmatterFromFile
instead of simply logging them.
Adding resolve(root, file)
here might do the trick.
Already using pathe
in all internal packages.
@kecrily Please upgrade @islands/pages
to 0.7.6
, which includes a patch that might fix this issue, and let me know how it goes.
@ElMassimo It doesn't seem to fix the bug, the errors are still the same.
@kecrily Added more debug information in iles@0.7.22-0
and @islands/pages@0.7.7-0
.
Would appreciate it if you can run DEBUG=iles* iles
and provide the logs, as in:
iles:pages:frontmatter reading: {
iles:pages:frontmatter root: '/Users/maximomussini/Projects/iles/playground/the-vue-point',
iles:pages:frontmatter filename: '/Users/maximomussini/Projects/iles/playground/the-vue-point/src/pages/posts/vue-3-2.mdx',
iles:pages:frontmatter resolved: '/Users/maximomussini/Projects/iles/playground/the-vue-point/src/pages/posts/vue-3-2.mdx'
iles:pages:frontmatter } +0ms
iles:documents ~/pages/posts {
iles:documents path: 'src/pages/posts',
iles:documents pattern: 'src/pages/posts/**/*.{md,mdx}',
iles:documents files: [
iles:documents 'src/pages/posts/hello-2021.mdx',
iles:documents 'src/pages/posts/vue-3-2.mdx',
iles:documents 'src/pages/posts/vue-3-one-piece.mdx'
iles:documents ]
iles:documents } +0ms
@ElMassimo
I updated and tried. But the log output has nothing related to iles:pages:frontmatter
or iles:documents
.
https://github.com/kecrily/iles-bug-reproduction/commit/9f5b88999eac8c870bda95bf706f8215a58fdaee
It seems like the DEBUG
expression didn't match all of the possible logs, or the page with the error was not requested.
Please try using npx cross-env "DEBUG=iles:*" npx iles
, and visit the page that has the error.
Visiting the page is important, because all processing happens on demand.
The logs returned by this command are still the same, but the logs that are needed after visiting the page appear. I think the original command worked too, I just didn't visit the page
Alright, getting closer, the path and glob pattern look good.
Would you update @islands/pages
as well to 0.7.7-0
?
The iles:pages:frontmatter
log should pinpoint why the error is happening.
I checked pnpm-lock.yaml again and @islands/pages
does not seem to have been upgraded with the pnpm upgrade
command.
What should I do now?
Run pnpm i -D @islands/pages@0.7.7-0
, or add it to package.json
and install.
Now it's here
https://github.com/kecrily/iles-bug-reproduction/commit/18d18ade29454eca38c2fc3f9d8fd6bda06331e9
Thanks for providing the logs!
The error seems to still be happening on this line, which is using the resolved
path.
The strange thing is that the error message mentions C:\src\posts\HelloWorld.md
, which is not the resolved
path.
If you open node
, and then run:
require('fs').existsSync('C:/Users/kecrily/Desktop/dev/iles-bug-reproduction/src/posts/HelloWorld.md')
does it return true
? What if you use readFileSync
or fs.promises.readFile
?
> node
Welcome to Node.js v16.13.1.
Type ".help" for more information.
> require('fs').existsSync('C:/Users/kecrily/Desktop/dev/iles-bug-reproduction/src/posts/HelloWorld.md')
true
> require('fs').readFileSync('C:/Users/kecrily/Desktop/dev/iles-bug-reproduction/src/posts/HelloWorld.md')
<Buffer 2d 2d 2d 0d 0a 74 69 74 6c 65 3a 20 48 65 6c 6c 6f 20 57 6f 72 6c 64 0d 0a 2d 2d 2d 0d 0a 0d 0a>
> require('fs').promises.readFile('C:/Users/kecrily/Desktop/dev/iles-bug-reproduction/src/posts/HelloWorld.md')
Promise {
<pending>,
[Symbol(async_id_symbol)]: 41,
[Symbol(trigger_async_id_symbol)]: 5,
[Symbol(destroyed)]: { destroyed: false }
}
Alright, the path is correct, and node is able to read the file.
I'm open to ideas here. Perhaps doing npm edit @islands/pages
and adding more logs manually, like inside the catch
and verify the error is happening there, and restarting iles
.
Fixed in @islands/pages
0.7.8
.
Thanks again @kecrily for providing detailed error information! Try running pnpm upgrade
, and it should bump the versions automatically.
iles
andvite
.Description 📖
Similar code appears differently in different components (specifically,
Header.vue
andList.vue
).Header.vue
is fine, whileList.vue
has a problem, the prompt tells me that HelloWorld.md cannot be found, the file actually exists and according to the error it links to an incorrect directory(C:\src\posts\HelloWorld.md
).Possible useful information: I am using Windows 11 and pnpm
Reproduction 🐞
Please provide a link to a repo that can reproduce the problem you ran into.
https://github.com/kecrily/iles-bug-reproduction
Dependencies Info
_Run `npx iles info` and `pnpm list` (or `npm list`) and provide the output:_ ``` iles v0.7.21 vite v2.7.10 devDependencies: iles 0.7.21 typescript 4.5.4 vite 2.7.10 vue-tsc 0.29.8 ```Logs 📜
If not providing a reproduction:
Output
_Run `DEBUG=iles:* npm run dev` or `DEBUG=iles:* npm run build` and provide the output:_ ``` ```Screenshots 📷
Provide console or browser screenshots of the problem.