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.

Build error with @floating-ui\core and Create React App

See original GitHub issue

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

React

Which UI component?

Authenticator

How is your app built?

Create React App

What browsers are you seeing the problem on?

No response

Please describe your bug.

Building a new project with this package results in the following error

TypeError: C:\Users\Sam\WebstormProjects\untitled\node_modules\@floating-ui\core\dist\floating-ui.core.browser.min.mjs: Cannot read properties of undefined (reading 'constantViolations')
    at transformFile.next (<anonymous>)
    at run.next (<anonymous>)
    at transform.next (<anonymous>)

What’s the expected behaviour?

build to succeed

Help us reproduce the bug!

tested with node 18

  1. start new project with npx create-react-app test-bug --template typescript
  2. install amplify ui npm i @aws-amplify/ui-react aws-amplify
  3. update src/App.tsx to the below content
  4. build npm run build

Code Snippet

// src/App.tsx
import React from 'react';
import {withAuthenticator, WithAuthenticatorProps} from '@aws-amplify/ui-react';
import '@aws-amplify/ui-react/styles.css';
import './App.css';

function App({ signOut, user } : WithAuthenticatorProps) {
  return (
      <div className="App">
        <p>Hello {user?.username || '?'}</p>
        <button onClick={signOut}>Sign out</button>
      </div>
  );
}

export default withAuthenticator(App);

Additional information and screenshots

{
  "dependencies": {
    "@aws-amplify/ui-react": "^4.3.0",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.2",
    "@types/node": "^16.18.10",
    "@types/react": "^18.0.26",
    "@types/react-dom": "^18.0.9",
    "aws-amplify": "^5.0.7",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "typescript": "^4.9.4",
    "web-vitals": "^2.1.4"
  }
}

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
reesscotcommented, Dec 22, 2022

If you’re using NPM, override the @babel/plugin-transform-block-scoping dependency to the known good version in your package.json file:

 "overrides": {
    "@babel/plugin-transform-block-scoping": "7.20.5"
  }

Or for Yarn:

"resolutions": {
    "@babel/plugin-transform-block-scoping": "7.20.5"
 },

@nishadthajudeen001 @seeratawan01 @sam159 This is fixing the CRA build for me.

3reactions
reesscotcommented, Dec 22, 2022

I’m seeing a new build error after @babel/plugin-transform-block-scoping@7.20.8 was released:

TypeError: /home/runner/work/amplify-ui/amplify-ui/canary/apps/react/cra/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs: Cannot set properties of undefined (setting 'kind')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Create React App not installing, showing an error and ...
I just re-downloaded the installer from the Node.js website. This should reinstall all the dependencies and make sure that all paths are valid....
Read more >
Troubleshooting - Create React App
It is reported that npm run build can fail on machines with limited memory and no swap space, which is common in cloud...
Read more >
Create React App without Create React App - Bits and Pieces
This article talks about the process of creating react app without using any libraries or frameworks such as “create-react-app” , “NextJS” etc.
Read more >
Use in create-react-app - Ant Design
create -react-app is one of the best React application development tools. We are going to use antd within it and modify the webpack...
Read more >
Building an Electron application with create-react-app
No webpack configuration or “ejecting” necessary. I recently built an Electron [http://electron.atom.io/] app using create-react-app ...
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