Create React App 2.0: Babel 7, Sass, and More — React Blog
The following is a brief translation
React doesn’t come with any compiler, so it’s hard to build a complex application without a test runner, a code compressor, and a proper code architecture. Since its first release, the Create React App has been designed to optimize project code and configuration to handle build and test tasks.
The tools on which the Create React App relies have been updated many times with much improved performance, such as Babel 7, WebPack 4, and Jest 23. However, manually updating these dependencies and integrating them is a daunting task. So the Create React App took a few months to upgrade to 2.0 to help with these dependencies and configurations.
Note: There is no rush to upgrade. If you’re happy with the performance and stability of your existing tool, you don’t need to upgrade to a new version! It is a good idea to wait for 2.0 to be stable for a while before upgrading.
New features
🎉 More options: Now you can use SASS and CSS Modules.
🐠 upgraded Babel to 7 with React Fragment syntax.
📦 has updated webpack to 4, making it smarter to split JS into multiple packages.
🃏 fixed Jest to 23 and you can call it “snapshots” in an interactive screen.
💎 You can now use Apollo, Relay Modern, MDX, and other third-party Babel macros.
🌠 You can import SVG as a React component and use it in JSX.
🐈 You can try Yarn’s Plug’n’Play mode, which removes node_modules.
🕸 You can insert your own proxy in development mode for easy testing of the back-end API.
🚀 Supports the latest version of Node.
💄 If you don’t plan to be compatible with IE, the new version can output smaller CSS code.
👷 Support Service workers
How to upgrade
If you haven’t eject, just update the “react-scripts” version to “2.0.3” in package.json and run NPM install.
It’s a bit more difficult if you have eject, so I suggest you revert the eject in version control software, then upgrade it, and then re-eject it.
The text to the end.
If you are learning React, you can add my wechat account frank_fang and use the password React