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

Error message detail + non valid error reports #93

Closed
krothmuller opened this issue Dec 14, 2020 · 11 comments
Closed

Error message detail + non valid error reports #93

krothmuller opened this issue Dec 14, 2020 · 11 comments
Labels
bug Something isn't working

Comments

@krothmuller
Copy link

krothmuller commented Dec 14, 2020

Error messages could be substantially improved.

image

Generally, there is reference to where the error occurred - ie which component

In addition, sometimes errors are reported and they are not valid. For example:
Can't render htmlComponent: ReferenceError: layout_components_Led_svelteMatrix is not defined
Can't render htmlComponent: ReferenceError: layout_components_Led_svelteMatrix is not defined
Total build took 475.769705ms

I have a LedMatrix.svelte file in my project (why is it reference in the error) and I can make changes to that file, it compiles fine and is used with the changes reflected in the browser

I included all the components in the components folder. (it is not pretty yet... just working on functionality)

components.zip

@jimafisk
Copy link
Member

I think you've discovered a bug in some regex I've written. What you're seeing there is the "component signature" for your LedMatrix.svelte component (the docs aren't great, but there are a few details on that here). The signature should probably be layout_component_ledmatrix_svelte not layout_components_Led_svelteMatrix. Any chance you could help me debug by doing the following:

  1. Paste your component in this issue so I can take a look?
  2. Confirm that the component appears at this path layout/components/LedMatrix.svelte exactly (or send the actual location)
  3. Paste the reference to the LedMatrix component from another file (to see how it's imported and used)

Plenti has to do things a little differently since we're compiling each component in v8 directly without using NodeJS or another runtime from the host machine. It makes it very strict about things like small JS syntax errors that might be ignored in other environments.

Thanks @krothmuller!

@krothmuller
Copy link
Author

krothmuller commented Dec 14, 2020 via email

@jimafisk
Copy link
Member

The frontend JS can be a little more forgiving than the server generated HTML, so there's a chance that the hydrated component is still rendering but the HTML fallback is broken behind the scenes. If you try a hard refresh on the specific page that's referencing the component you might see weird behavior like it going to a different page than the one you expected. It also could just be cached like you mentioned. If you feel comfortable sharing a link to your project, I'd be happy to spin it up locally and take a look. Thanks for documenting the bug!

@krothmuller
Copy link
Author

krothmuller commented Dec 14, 2020 via email

@jimafisk
Copy link
Member

Oh sorry I didn't even see the attachment! I'll take a look at that and see if I can figure out what's going on here.

Yes that's what I meant by hard refresh, so it's probably something different than I thought. I'll follow up once I've taken a look. Thanks!

@jimafisk
Copy link
Member

This was a Plenti bug, not something you were doing incorrectly. I just pushed a release that should fix the issue, so if you upgrade Plenti to v0.3.4 it should stop giving you this error.

It's related to the string replacement issue here: #62 (your specific issue should be fixed but that one is still broken).

Screenshot from working local copy

bitmap_maker

Just let me know if it's still giving you trouble! Thanks!

@jimafisk jimafisk added the bug Something isn't working label Dec 15, 2020
@krothmuller
Copy link
Author

krothmuller commented Dec 15, 2020 via email

@jimafisk
Copy link
Member

Here's an example repo for this issue in case it's helpful: https://github.com/jimafisk/plenti_bitmap_maker_example

@krothmuller
Copy link
Author

krothmuller commented Dec 16, 2020 via email

@jimafisk
Copy link
Member

Lots of good points @krothmuller!

brew upgrade plentico/plenti/plenti

I haven't used homebrew in a few years, so I actually didn't know the correct way to update - thanks for testing that out! I'm surprised by the extra "plenti" as well, and would love to fix this so it's not needed. I assume this has something to do with the fact that I set it up as a Tap (Third-Party Repository). I'll play around with this to see if it can be streamlined a bit

I assume you take the latest builds form Svelte (at some kind of regular interval)?

I do manually bundle up newer versions of Svelte into the Plenti CLI (the Go engine that builds plenti sites). There's a whole workflow that happens behind the scenes that allows you to take over this process and begin managing your NPM packages independently of what Plenti is doing though. Common example scenarios:

  1. The Plenti project falls behind in NPM updates and you want the latest feature that was just rolled out in Svelte. You can just npm update svelte and start using the newer version.
  2. You want to add an NPM package to assist in your frontend development. Just install it like normal npm install whatever.

Plenti will respect your updates and stop trying to use the defaults for the build, and this worked really well in the past but now there is one major hurdle preventing this from working properly. We're using a modified version of svelte (#76). It's increasingly looking like the Svelte project is not going to pull in an update to make our desired hydration process work properly, so I'm going to have to look at another approach for this. It's likely that I will end up processing the svelte package in Go to add the needed modification so that folks can start managing their own packages again, and we'll just fix standard Svelte on the fly to work with Plenti.

Keep in mind if you modify your NPM packages, you'll need to account for this in CI so Plenti does not try to use the default packages (usually just means running npm install on your modified package.lock file before running plenti build).

So to update to the latest version of Svelte, one would need to do a "Plenti new site” and take the npm-module folder and use it to replace the current project version - correct?

No, you could simply delete your current node_modules/ folder and rebuild plenti build or plenti serve (assuming you updated Plenti with homebrew already).

Thanks @krothmuller!

@jimafisk
Copy link
Member

Hi @krothmuller, I opened a new issue about updating the docs for upgrading to newer versions of Plenti: #102. I think we closed out the other threads on this issue, so I'm going to close this issue. If I missed something, feel free to reopen! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants