EmilTholin / svelte-routing

A declarative Svelte routing library with SSR support
MIT License
2.02k stars 178 forks source link

Import issue when using esbuild #271

Closed tbxMb closed 10 months ago

tbxMb commented 10 months ago

When using a version > 2.6 (after fb61ada) i get the following error

✘ [ERROR] Could not resolve "svelte-routing"

    frontend/src/App.svelte:23:30:
      23 │ import { Router, Route } from "svelte-routing";
         ╵                               ~~~~~~~~~~~~~~~~

  The package target "src/index.js" is invalid because it doesn't start with "./":

    node_modules/svelte-routing/package.json:23:22:
      23 │             "svelte": "src/index.js"
         ╵                       ~~~~~~~~~~~~~~

  You can mark the path "svelte-routing" as external to exclude it from the bundle, which will
  remove this error and leave the unresolved path in the bundle.

changing src/index.js to ./src/index.js fixes the issue.