-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Thank you for making this template, it simplifies the process so much!
I have a question that may be simple to solve, or I may be misunderstanding something more fundamental.
I want to import a function from a TS file into the App svelte component from your template. The function uses the Twitter v2 API, so that might be causing an issue.
I use the following code to import the function into App:
<script lang="ts">
import { getUserDesc } from "../electron/utils/Twitter/twitter";
export let name: string;
</script>
Where the twitter.ts
file looks like so:
import TwitterApi from 'twitter-api-v2';
const twitter = new TwitterApi()
const roClient = twitter.readOnly
export async function getUserDesc(username: string) {
const user = await roClient.v2.userByUsername(username)
console.log(user.data.description)
}
When running the code, I get the following error: Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
.
Is it that I just need a rollup-plugin? Please let me know if there is something to do differently.
Thank you for reading this :)
Metadata
Metadata
Assignees
Labels
No labels