Skip to content

Breaking change with latest @babel/core update #12017

Closed
@elorzafe

Description

@elorzafe

Describe the bug

With latest version of create-react-app that is using @babel/[email protected] (launched 2/2/22 at 15:00PST) the same App that was use to build correctly now is throwing build errors.

Did you try recovering your dependencies?

yes

Which terms did you search for in User Guide?

babel
react-scripts

Environment

(paste the output of the command here.)

Steps to reproduce

  1. Init my app
npx create-react-app test-app
cd test-app
npm i aws-amplify
  1. Add AWS Amplify to my App
import logo from './logo.svg';
import './App.css';
import Amplify from 'aws-amplify';


function App() {
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

export default App;
  1. Start my app
    npm start

Expected behavior

Build and run the app with no errors (as it used to happen previously)

(Write what you thought would happen.)

Actual behavior

When building the App I have this errors

Compiled with problems:X

ERROR in ./node_modules/@aws-crypto/ie11-detection/build/CryptoOperation.js

Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: /private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@aws-crypto/ie11-detection/build/CryptoOperation.js: Cannot read properties of undefined (reading 'originalPositionFor')
    at SourceMapTree.originalPositionFor (/private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@ampproject/remapping/dist/remapping.umd.js:159:27)
    at trace (/private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@ampproject/remapping/dist/remapping.umd.js:102:37)
    at EncodedSourceMapImpl.map (/private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js:347:36)
    at TraceMap.map (/private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js:430:31)
    at SourceMapTree.traceMappings (/private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@ampproject/remapping/dist/remapping.umd.js:85:34)
    at remapping (/private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@ampproject/remapping/dist/remapping.umd.js:258:36)
    at mergeSourceMap (/private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@babel/core/lib/transformation/file/merge-map.js:19:30)
    at generateCode (/private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@babel/core/lib/transformation/file/generate.js:72:39)
    at run (/private/var/folders/mk/36m2f9gx7h5bblhkkx68fv1ck8cth9/T/tmp.PwdKmnIU/test/node_modules/@babel/core/lib/transformation/index.js:55:33)
    at run.next (<anonymous>)

and similar error on other packages

Reproducible demo

git clone https://github.com/elorzafe/cra-issue-babel.git
cd cra-issue-babel
npm i
npm start

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions