ItalyPaleAle / svelte-spa-router

Router for SPAs using Svelte 3
MIT License
1.53k stars 105 forks source link

Typescript support: Package path ./wrap is not exported from package svelte-spa-router #317

Open jmarkyston opened 7 months ago

jmarkyston commented 7 months ago

I really love the quality of life this package brings.

I'm trying to use this in a typescript setting, so rather than a routes.js file, I've added a routes.ts file, which looks like this:

import Login from './views/login.svelte';
import Dashboard from './views/dashboard.svelte';
import {wrap} from 'svelte-spa-router/wrap'

export const routes = {
  '/': Login,
  '/dashboard': wrap({})
}

When I import and attempt to use wrap(), I get the Package path ./wrap is not exported from package svelte-spa-router error.

My tsconfig has allowJs and allowSyntheticDefaultImports turned on, but this error still exists. I've also tried importing it like `import * as wrap from 'svelte-spa-router/wrap', but I get the same error.

I see a ts type definition for the wrap file. Do you know why this isn't working for me?

ItalyPaleAle commented 7 months ago

Can you confirm you're setting "type": "module" in your package.json?

jmarkyston commented 7 months ago

It wasn't set, but it is now. I updated my webpack config to support that. Sadly, I'm getting the same error. I tried removing node_modules and package.lock and running npm i again just in case, but that didn't help.