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

create-react-app Update Steps #25

Open
1 of 8 tasks
coryhouse opened this issue Nov 25, 2018 · 3 comments
Open
1 of 8 tasks

create-react-app Update Steps #25

coryhouse opened this issue Nov 25, 2018 · 3 comments
Assignees
Labels

Comments

@coryhouse
Copy link
Owner

coryhouse commented Nov 25, 2018

The course was published using create-react-app 1.

Create-react-app 3 involves the following breaking changes that aren't yet reflected in the course:

NOTE: Checked boxes below signify patched, but need to be published and uploaded.

  • create-react-app 3 only generates one webpack.config. It uses env vars for settings. Need to update videos to reflect
  • In "Testing" module, in Demo: Unit Testing, install the react-test-renderer version that matches your React version. Check package.json to see the version of React you're using. For example, if you're running React 16.8.0, then npm install react-test-renderer@16.8.0.
  • Eliminate the separate /utils file that we create in M9-10 (testing) since it ultimately isn't used and can't be published that way because /utils doesn't get published.
  • In the "Publishing" module, in Demo: Production Component Library Build, make the following tweaks to the babel config:
    • This is patched at 2:22, but need to record this audio: "Note that I'm referencing the babel preset under the babel namespace. We're telling babel to transpile our modules to commonJS format, which is a common standard for npm packages. And we're tweaking the configuration of react-app. We're setting the absolute runtime to false on the react-app preset. Otherwise the react-app preset will try to reference the babel runtime locally. We're setting helpers to false too. You can set helpers to true to potentially reduce your bundle sizes, but you need to add @babel/runtime as a dependency of your component library if you do so."
    • Babel 7 moved their packages under the @babel namespace. So, check your package.json for the version of @babel/core installed by create-react-app, and install the corresponding versions of @babel/preset-env and @babel/cli. For example, if @babel/core 7.1.0 is installed, then run this: npm i @babel/preset-env@7.1.0 @babel/cli@7.1.0.
    • Reference @babel/env (instead of babel-env)
    • Update final exercise files to reflect being generated from cra 3

In summary, do this:

  "babel": {
    "presets": [
      [
        "@babel/preset-env",
        {
          "modules": "commonjs"
        }
      ],
      [
        "react-app",
        {
          "helpers": false,
          "absoluteRuntime": false
        }
      ]
    ]
  },
@coryhouse coryhouse self-assigned this Nov 25, 2018
@coryhouse coryhouse added the bug label Nov 25, 2018
@coryhouse coryhouse changed the title Update Steps Create-react-app 2 Update Steps Nov 25, 2018
@coryhouse coryhouse changed the title Create-react-app 2 Update Steps create-react-app 2 Update Steps Nov 25, 2018
@martysh
Copy link

martysh commented Mar 15, 2019

Hi Cory, thanks so much for this course, it's been quite helpful to me. to follow up on this, setting "modules":"false" is all it's needed to produce the es6 module build?

@coryhouse
Copy link
Owner Author

Thanks! Yes, I believe that's correct. You can also check out nwb as an example of an ES module build config.

@coryhouse coryhouse changed the title create-react-app 2 Update Steps create-react-app Update Steps Jun 27, 2019
@EdgarAGuevara
Copy link

Thanks.. A LOT!. Cory that issue was me crazy. For now, everything Good

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

No branches or pull requests

3 participants