1

Hello beautiful humans!

I'm working on building a project that uses React Webapp for the frontend, using Prisma to go from javascript to MySql with Aiven to then Twitter API to create auto posts.

GitHub: https://github.com/jennjunod/twitter-tagging

Using this guide from Prisma... Using Miro as a visual representation

Failed to compile.

Error in ./src/reportWebVitals.js
Syntax error: 'import' and 'export' may only appear at the top level (3:0)

  1 | const reportWebVitals = onPerfEntry => {
  2 |   if (onPerfEntry && onPerfEntry instanceof Function) {
> 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
    | ^
  4 |       getCLS(onPerfEntry);
  5 |       getFID(onPerfEntry);
  6 |       getFCP(onPerfEntry);

 @ ./src/index.js 19:23-54
Jenn Junod
  • 11
  • 1
  • Based on the error message `"Syntax error: 'import' and 'export' may only appear at the top level"` it seems like the issue is that you're using `import` inside of a Lambda function, which means it's _scoped_ and therefore not top-level any more. Did you created this `reportWebVitals.js` file yourself or where did you get it from? – nburk Oct 25 '22 at 13:56

0 Answers0