Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change with latest @babel/core update #12017

Closed
elorzafe opened this issue Feb 3, 2022 · 3 comments
Closed

Breaking change with latest @babel/core update #12017

elorzafe opened this issue Feb 3, 2022 · 3 comments

Comments

@elorzafe
Copy link

elorzafe commented Feb 3, 2022

Describe the bug

With latest version of create-react-app that is using @babel/core@7.17.0 (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
@ecraig12345
Copy link

ecraig12345 commented Feb 3, 2022

Seems related to babel/babel#14209 (switching to use@ampproject/remapping for source map merging), which was released with 7.17.0. Not sure if the root cause is in @babel/core or @ampproject/remapping.

@patotoma
Copy link

patotoma commented Feb 3, 2022

looks like resolved by babel/babel#14229 (comment)

@elorzafe
Copy link
Author

elorzafe commented Feb 3, 2022

Now works like a charm, I will close the issue.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants