"Module parse failed: Unexpected token" when using Lenis-React
PixelPage-YT opened this issue · comments
Describe the bug
I get this error when using anything from lenis react:
Module parse failed: Unexpected token (3:5)
| import Lenis, { LenisOptions } from '@studio-freight/lenis';
| import React, { ForwardRefExoticComponent, PropsWithoutRef, ReactNode, RefAttributes } from 'react';
type LenisEventHandler = (lenis: Lenis) => void;
| interface LenisContextValue {
| lenis: Lenis;
Import trace for requested module:
./node_modules/@studio-freight/react-lenis/dist/types/index.d.ts
./src/components/containers/drawer.tsx
./src/app/(index)/(sections)/(topics)/section.tsx
Although, looking at the file, everything seems correct.
Reproduce Repo
https://github.com/PixelPage-YT/lenis-error
Oops, i figured out my import was messed up.
The weird thing is now it works in my initial environment but not the one i used to reproduce. There, i get this error now: Error: (0 , react__WEBPACK_IMPORTED_MODULE_1__.createContext) is not a function
it works everywhere else 🤷♂️
Yes since it even works in my project we can close this ig
thank you
you need 'use client' on top of the file @PixelPage-YT