question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import error with snowpack and typescript

See original GitHub issue

Reduced Test Case

https://github.com/abumalick/snowpack-fullcalendar

Bug Description

Using snowpack with typescript as a bundler, when I try the example React implementation of the library. I got an error:

Uncaught Error: Please import the top-level fullcalendar lib before attempting to import a plugin.

Screenshots

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mylastorecommented, May 4, 2021

import '@fullcalendar/core/vdom.js'

this work for me also with @sveltejs/kit

3reactions
charkourcommented, Mar 1, 2021

I was able to resolve it by importing from @fullcalendar/react/dist/vdom.js rather than from the core package.

import React from "react";
import "@fullcalendar/react/dist/vdom.js"; // KEY CHANGE
import FullCalendar from "@fullcalendar/react";
import type { CalendarOptions } from "@fullcalendar/common";
import interactionPlugin from "@fullcalendar/interaction"; 
import timeGridPlugin from "@fullcalendar/timegrid"

export const Calendar = (props: CalendarOptions) => {
  return (
    <>
      <FullCalendar {...props} />
    </>
  );
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Package not found error when importing .d.ts file #2211 - GitHub
I can get the Snowpack error to go away by adding a .d.ts extension to the import, but then TypeScript becomes unhappy and...
Read more >
Common Error Details - Snowpack
If you are using TypeScript, this error could occur if you are importing or exporting something that only exists in TypeScript (like a...
Read more >
Snowpack Typescript Imports - Stack Overflow
When I copy-paste the class to a local file and import it using local imports (like below), it works. import SomeClass from './ ......
Read more >
Snowpack for Svelte development revisited - codechips
The ES2020 import.meta.env works out of the box, but not in my Vim editor. svelte + ts error in vim.
Read more >
@snowpack/plugin-typescript - npm
This plugin adds TypeScript type checking to any Snowpack project.. Latest version: 1.2.1, last published: 2 years ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found