Reputation: 2999
I was curious if there is any way to sort of group svelte components together.
What I am doing now is this
import Button from "./common/Button.svelte";
import Link from "./common/Link.svelte";
import Text from "./common/Text.svelte";
But it would be nice to group them so that I could write something like this
import {Button, Link, Text} from "./common";
Is this possible?
I've tried just creating a js file
import Button from "./Button.svelte";
import Link from "./Link.svelte";
import Text from "./Text.svelte";
export default {
Button,
Link,
Text,
};
But when I try to use it I just get the error Text is not a constructor
so I assume that I am doing something wrong there
Upvotes: 3
Views: 830
Reputation: 2999
This seems to have been the solution
export { default as Button } from "./Button.svelte";
export { default as Text } from "./Text.svelte";
export { default as Link } from "./Link.svelte";
Upvotes: 4