Closed jm-bh closed 1 year ago
Turns out this is an issue with Next.js, not Astro. Sorry about that!
For anyone else that runs into this issue, you need to use the transpilePackages
option in next.config.js
:
{
...
transpilePackages: [
'@astrouxds/react',
'@astrouxds/astro-web-components',
],
}
That's a good gotcha, we'll throw that in our docs. Thanks for letting us know!
Describe the bug When importing components into a Next.js (React framework) app, Astro throws
SyntaxError: Unexpected token 'export'
.To Reproduce Steps to reproduce the behavior:
yarn create next-app
yarn add @astrouxds/react
pages/_app.tsx
Current behavior While rendering, a
SyntaxError
is thrown. The error comes from@astrouxds/react/dist/index.js:1
:export * from "./components";
Expected behavior No error
Screenshots
CodeSandbox View the problem on StackBlitz
Environment (please complete the following information):
Additional context n/a