lucide
lucide copied to clipboard
SyntaxError: Unexpected token 'export'
Package
- [ ] lucide
- [ ] lucide-angular
- [ ] lucide-flutter
- [ ] lucide-preact
- [X] lucide-react
- [ ] lucide-react-native
- [ ] lucide-solid
- [ ] lucide-svelte
- [ ] lucide-vue
- [ ] lucide-vue-next
- [ ] Figma plugin
- [ ] source/main
- [ ] other/not relevant
Version
0.314.0
Browser
- [ ] Chrome/Chromium
- [ ] Firefox
- [ ] Safari
- [ ] Edge
- [ ] iOS Safari
- [ ] Opera
- [ ] Other/not relevant
Operating system
- [X] Windows
- [ ] Linux
- [ ] macOS
- [ ] Other/not relevant
Description
i made some shared components for the internal library with turbo repo, after build and publish then we consume we got
SyntaxError: Unexpected token 'export' like this
import type { LucideProps } from "lucide-react";
import dynamicIconImports from "lucide-react/dynamicIconImports.js";
import { lazy, Suspense } from "react";
import { cn } from "../../utils";
interface IconProps extends Omit<LucideProps, "ref"> {
name: keyof typeof dynamicIconImports;
}
export function Icon({
className = "",
name,
...props
}: IconProps): JSX.Element {
const LucideIcon = lazy(dynamicIconImports[name]);
return (
<Suspense>
<div className={cn("w-4 h-4", className)}>
<LucideIcon className={cn("w-4 h-4", className)} {...props} />
</div>
</Suspense>
);
}
Steps to reproduce
- create component Icon.tsx using turbo repo
import type { LucideProps } from "lucide-react";
import dynamicIconImports from "lucide-react/dynamicIconImports.js";
import { lazy, Suspense } from "react";
import { cn } from "../../utils";
interface IconProps extends Omit<LucideProps, "ref"> {
name: keyof typeof dynamicIconImports;
}
export function Icon({
className = "",
name,
...props
}: IconProps): JSX.Element {
const LucideIcon = lazy(dynamicIconImports[name]);
return (
<Suspense>
<div className={cn("w-4 h-4", className)}>
<LucideIcon className={cn("w-4 h-4", className)} {...props} />
</div>
</Suspense>
);
}
- build and publish to npm
- consume the library
- then we got this
Checklist
- [X] I have searched if someone has submitted a similar issue before and there weren't any. (Please make sure to also search closed issues, as this issue might already have been resolved.)
Hey @xhttp-res have you managed to resolve that issue somehow?
nope @Kozioleczek 😿