Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Issue accessing components in Git subtree - Error: Cannot find module

$
0
0

I am encountering an issue while trying to access a component from a Git subtree in my Svelte project. Here’s a simplified view of my project structure:

root- .subtree  - imports    - ui      - Searchbar.svelte- imports  - ui    - App.svelte

I am attempting to import Searchbar.svelte from the .subtree directory into App.svelte. However, I keep getting an error: Error: Cannot find module /.subtree/imports/ui/ThreeColumnLayout.svelte.

Here’s the snippet from App.svelte where I attempt to import and use Searchbar.svelte:

<script>  import Searchbar from "/.subtree/imports/ui/ThreeColumnLayout.svelte";  // Assuming these are required props for Searchbar  export let placeholder = "Search Here...";</script><div class="relative"><label for="search" class="absolute flex items-center left-2 top-2 justify-center"><!-- Placeholder SVG code --><svg width="24" height="24" viewBox="0 0 24 24"><path d="m21 21-5.2-5.2m0 0A7.5 7.5 0 1 0 5.2 5.2a7.5 7.5 0 0 0 10.6 10.6" /></svg></label><!-- Use the Searchbar component --><Searchbar {placeholder} /></div>

I have tried different file paths such as ../../.subtree/imports/ui/ThreeColumnLayout.svelte and /.subtree/imports/ui/ThreeColumnLayout.svelte, but the error persists.


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>