tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
485 stars 38 forks source link

Importing components from npm modules doesn't work #37

Closed maciej-trebacz closed 5 years ago

maciej-trebacz commented 5 years ago

This is for version 0.8.0.

When I import components using their npm names it doesn't work, i.e. the IDE gives an "Unresolved Svelte component" error. Here's a minimal reproduction:

<script>
  import MyComponent from "./MyComponent.svelte";
  import {Router, Route} from "svelte-routing";
  export let url = "";
</script>

<main>
  <Header />
  <Router url="{url}">
    <Route path="/"><MyComponent/></Route>
  </Router>
</main>

This gives "Unresolved Svelte component" error for Router and Route components. Notice that importing components from a file works, as does importing from svelte-routing like the IDE suggests:

  import Router from "../../node_modules/svelte-routing/src/Router.svelte";
  import Route from "../../node_modules/svelte-routing/src/Route.svelte";
tomblachut commented 5 years ago

Ah snap we need to conditionally suppress this inspection until proper support for node modules is implemented

bevand10 commented 5 years ago

On a connected note, is this ever likely to be supported?

import Header from "http://my-internal-shared-component-repo.corp.co.uk/Header.svelte";
tomblachut commented 5 years ago

@bevand10 never seen that one. How does it work in command line?