Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message when markdown extension is mispelled #351

Open
goblinfactory opened this issue Sep 11, 2024 · 3 comments
Open

Better error message when markdown extension is mispelled #351

goblinfactory opened this issue Sep 11, 2024 · 3 comments
Labels
improvement nuemark Related to nuemark package

Comments

@goblinfactory
Copy link
Contributor

goblinfactory commented Sep 11, 2024

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

  1. Build should fail, server error should report
Unknown component [Foo] in file /blogs/demo.md
  1. 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

  1. add any non existent extension to any markdown file e.g. add [Foo] to any page.
  2. run nue and browse to that page, press F12, observe error in chrome console
@goblinfactory goblinfactory added improvement new feature New feature or request labels Sep 11, 2024
@goblinfactory goblinfactory changed the title Better error message when markdown extension is mispelled (doesnt exist) crashes with "Failed to resive module specifier '' Better error message when markdown extension is mispelled Sep 11, 2024
@nobkd nobkd added nuemark Related to nuemark package and removed new feature New feature or request labels Sep 11, 2024
@tipiirai
Copy link
Contributor

I cannot reproduce this error. Can you provide a minimum source code that produces the bug. Thanks!

@goblinfactory
Copy link
Contributor Author

goblinfactory commented Sep 12, 2024

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.

Screenshot 2024-09-12 at 10 36 23

@nobkd
Copy link
Collaborator

nobkd commented Sep 25, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement nuemark Related to nuemark package
Projects
None yet
Development

No branches or pull requests

3 participants