Better error message when markdown extension is mispelled
Better error message when markdown extension is mispelled (doesnt exist) crashes with "Failed to resolve module specifier ''
Runtime error after adding "component"
WHEN
- mispelling a custom markdown extension or adding a coponent that doesnt exist e.g.
[Foo]THEN - get the following runtime client error in browser (tested with Chrome and Safari)
Uncaught (in promise) TypeError: Failed to resolve module specifier ''
at importAll (mount.js:18:21)
at mountAll (mount.js:26:30)
at mount.js:49:33
at mount.js:50:44
Expected behaviour
- Build should fail, server error should report
Unknown component [Foo] in file /blogs/demo.md
- Build should check for the existence of file, and if not included, build error should instead be
Unknown component [Foo] in file /blogs/demo.md,
Did you mean to include /components/foo.html ?
click [link to docs on how to include components] <-- link goes here
Environment
- OS: OSX
- bun
- bun
- Nuekit Version: ✓ Nue 1.0.0-beta.1 • Bun 1.1.27
Remarks
I believe this is quite important because when doing some dev work, (not writing markdown content), it's easy to miss the error message in chrome and I have not yet established what the crash in the client might also break or what unexpected behaviour this causes.
Minimal Reproduction
- add any non existent extension to any markdown file e.g. add
[Foo]to any page. - run nue and browse to that page, press F12, observe error in chrome console
I cannot reproduce this error. Can you provide a minimum source code that produces the bug. Thanks!
minimum source code is
---
include: [ gallery, motion ]
content_collection: blog
---
# Minimalist, UX developer, designer, urban explorer.
I’m Emma Bennett, an user experience developer from Berlin. I build websites that are exceptionally well designed — inside, and outside.
[foo]
[gallery]
literally all I did was run nue create then edit index.md and added [foo], that's it.
Screenshot below is;
top left: vscode open at index.md
top right; console window showing me running nue create from new empty dir
bottom right; error message you see when F12 in chrome that this issue is reporting.
I personally would probably just add a warning on CLI output, if there is a is= component, that has no equivalent in the nue runtime components, (I think there was a possibility to use web components instead somehow)
I think the is= can occur, if the nue component is not found, or is a dynamic component. Layout components get completely replaced (or contain a dynamic component)