From 70a6a0f795c8ea92024ce002e56b2721cef22d09 Mon Sep 17 00:00:00 2001 From: James Mead Date: Fri, 20 Sep 2024 12:50:07 +0100 Subject: [PATCH 1/2] Use $views alias to import MyComponent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I see the following error when viewing the home page: Started GET "/" for 127.0.0.1 at 2024-09-20 12:49:08 +0100 Processing by HomeController#show as HTML Rendering layout layouts/application.html.erb Rendering home/show.html.svelte within layouts/application ✘ [ERROR] Could not resolve "$views/home/MyComponent.html.svelte" app/views/home/show.html.svelte:9:24: 9 │ import MyComponent from "$views/home/MyComponent.html.svelte"; ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can mark the path "$views/home/MyComponent.html.svelte" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. Rendered home/show.html.svelte within layouts/application (Duration: 460.6ms | GC: 0.0ms) Rendered layout layouts/application.html.erb (Duration: 460.8ms | GC: 0.0ms) Completed 500 Internal Server Error in 463ms (ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.1ms) ActionView::Template::Error (undefined method `dig' for nil:NilClass): Causes: NoMethodError (undefined method `dig' for nil:NilClass) app/views/home/show.html.svelte:32:in `new' app/views/home/show.html.svelte:32 --- app/views/home/show.html.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/home/show.html.svelte b/app/views/home/show.html.svelte index 497e69b..541ccd0 100644 --- a/app/views/home/show.html.svelte +++ b/app/views/home/show.html.svelte @@ -1,5 +1,5 @@ From 511e12bfb5fcdeffd84fb14c58952134c8148d26 Mon Sep 17 00:00:00 2001 From: James Mead Date: Sun, 22 Sep 2024 09:05:32 +0100 Subject: [PATCH 2/2] Upgrade actionview-svelte-handler to fix aliases --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8f79f1d..aee89d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://codeberg.org/reesericci/actionview-svelte-handler.git - revision: 6c5e8c30649482a77d6e846cd1d64e0d4facefdb + revision: ebc44dfb3c97c9de475bd45b9821b14847a51868 specs: actionview-svelte-handler (0.5.7) rails (~> 7.0)