1.0.0 (May 18, 2017)
We’ve been working on this release for the past few months, and there are many big impovements, from migrating to webpack 2 to a brand new runtime error overlay and built-in support for Progressive Web Apps.
So instead of just enumerating them here, we decided to write a blog post about all the new features.
Check it out: What’s New in Create React App.
Have you read it? Now let's see how to update your app to the latest version.
Migrating from 0.9.5 to 1.0.0
First, ensure you are using the latest Node 6 LTS or newer. In 1.0.0, we have dropped support for Node 4 and NPM 2.
Inside any created project that has not been ejected, run:
npm install --save-dev --save-exact react-scripts@1.0.0
You may also optionally update the global command-line utility for bug fixes:
npm install -g create-react-app
Ensure application and test files reside in src/
We've never supported importing files from outside src/
, nor have we supported running tests outside of src/
.
We also never explicitly forbid doing so, which caused confusion when things didn't work like they should.
When running or building your application, you may see a message like so:
You attempted to import ... which falls outside of the project src/ directory.
To remedy this, simply move any files that you import
within src/
and update your relative imports accordingly. This enforces that files that import
each other stay in src/
, and other folders serve different purposes (e.g. the public/
folder just gets served from the root).
If you used relative imports outside the project directory as a way to share code with another project, consider using a monorepo instead, so that other projects are symlinked to your project's node_modules/
. Then you can import them as a Node modules.
While running npm test
, you may notice some of your tests are missing. Please move any top-level test directory (i.e. __test__
, __spec__
) or files (i.e. *.test.js
, *.spec.js
) into src/
. Conversely, if you have some similarly named files that you don’t want Jest to run, move them outside of src/
.
Import required locales for Moment.js
Moment.js locales are now purposely excluded from the bundle unless explicitly depended on.
Please import the locales you need:
import moment from 'moment';
import 'moment/locale/fr';
import 'moment/locale/es';
You can no longer import file content
You can no longer import a file and expect to receive its contents as an encoded string.
This behavior was confusing and inconsistent depending on the file size.
Importing files with unknown extensions will now always include them into the build and return a valid URL.
If you'd like to import a file's contents as a string, consider contributing to #1944.
For the time being, you must embed assets within an export:
// sample.txt
export default `i want
this data as a string
`;
You can then import this as so:
import sampleText from './sample.txt';
// ...
Confusing window globals can no longer be used without window
qualifier
Please prefix any global method with window.
, you may experience this with methods such as confirm
.
Simply update references from confirm
to window.confirm
.
Note that this new lint error will likely uncover legitimate accidental uses of global variables where you meant to define a local variable instead.
Why is my import erroring out?
You can no longer use AMD import syntax, nor define an import anywhere other than the top of the file.
This is to reduce confusion around import statements, which do not allow you to evaluate code between them.
I see many accessibility warnings
We have enabled a new set of rules to help make applications more accessible, please take time to learn about the errors and fix them.
You can search for every lint rule name in the right column and read its description on the web. The fixes are usually very simple.
I see many warnings about PropTypes and createClass
We have enabled the lint warnings about React APIs deprecated in React 15.5.
You can automatically convert your project to fix them by running the corresponding codemods.
How do I make my tests work with Jest 20?
Please refer to the Jest 19 and Jest 20 breaking changes for migration instructions.
If you use snapshots, you will likely need to update them once because of the change in format.
Flexbox 2009 spec is no longer polyfilled
The old, 2009 specification for Flexbox is deprecated and is 2.3x slower than the latest specification.
We are no longer polyfilling it automatically.
I see "Definition for rule 'jsx-a11y/alt-text' was not found (jsx-a11y/alt-text)" in the editor
Follow these steps if you see errors about missing lint rules in the editor.
- Ensure that in your editor ESLint settings you have "Use Global ESLint" turned off
- Run
npm install
in your project (oryarn
) - Quit your editor completely (ensure its process doesn't hang around)
- Start the editor again
If you still have the problem please file an issue.
How to turn my app into a Progressive Web App?
After the regular update procedure above, add these line to <head>
in public/index.html
:
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
Then create a file called public/manifest.json
that looks like this:
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
Finally, create src/registerServiceWorker.js
with this template, import it from src/index.js
and call the function it exports.
Anything missing?
This was a large release, and we might have missed something.
Please file an issue and we will try to help.
Some of my tests started crashing because of unhandled rejections
Unhandled Promise rejections will now crash tests. You can fix them by explicitly catching the errors you don’t care about.
Detailed Changelog
For a readable summary of the changes, check out our blog post.
💥 Breaking Change
react-dev-utils
,react-scripts
react-scripts
- #2187 Ignore Moment.js locales by default. (@gaearon)
- #1808 Only run tests in
src/
(#544). (@motevets) - #1771 Some flexbox bugs are autofixed, and support for 2009 spec is dropped. (@cr101)
- #1614 Upgrade to Jest
19(now 20). (@rogeliog) - #1305 Whitelist files that can be embedded through url-loader. (@pugnascotia)
eslint-config-react-app
,react-dev-utils
eslint-config-react-app
,react-error-overlay
,react-scripts
- #2163 Upgrade
eslint-plugin-jsx-a11y
and activate more rules. (@AlmeroSteyn)
- #2163 Upgrade
eslint-config-react-app
,react-scripts
🚀 New Feature
react-scripts
- #1728 Scaffolded applications are now Progressive Web Apps by default. (@jeffposnick)
- #1344 Support multiple env configuration files. (@tuchk4)
- #2168 Enable CSS sourcemaps in production. (@gaearon)
- #1830 Make subset of Jest options overridable. (@ryansully)
react-dev-utils
,react-scripts
eslint-config-react-app
,react-scripts
- #2163 Upgrade
eslint-plugin-jsx-a11y
and activate more rules. (@AlmeroSteyn)
- #2163 Upgrade
🐛 Bug Fix
react-scripts
- #2219 Improve interaction between compile and runtime overlays (@gaearon)
- #2200 Disable Uglify reduce_vars. (@gaearon)
- #2166 Support hoisting
react-scripts
and addrequire.resolve()
to loaders. (@gaearon) - #2115 Do not respect
.eslintignore
. (@Timer) - #2063 Ignore yarn cache directory when searching for tests. (@jmorrell)
- #2050 Name development chunk names. (@herrstucki)
- #2013 Minify CSS post-webpack 2. (@viankakrisna)
- #1839 Resolve
localhost
when offline (Windows). (@bunshar) - #1301 Bind to host environment variable. (@GAumala)
- #1890 Ensure proxy url starts with
http://
orhttps://
. (@bunshar) - #1861 Upgrade
detect-port
. (@Andreyco) - #1821 Fix default responsive behavior in iOS 9+. (@GreenGremlin)
- #1819 Makes end-to-end testing crash on unhandled rejections. (@dbismut)
- #1810 Fixes a silent crash when ejecting. (@gaearon)
- #1727 Fix ejecting from a scoped fork. (@gaearon)
react-dev-utils
- #2076
openBrowser
now supports urls with more than one parameter. (@alisonmonteiro) - #1690 Fix
openBrowser()
whenBROWSER=open
on macOS. (@bpierre) - #1696 Fix an edge-case for people with the username
cwd
. (@chrisdrackett)
- #2076
create-react-app
- #1863 Check internet connectivity with lookup instead of resolve. (@kdleijer)
- #1867 Show package name in CLI. (@mkazantsev)
- #1706 Properly extract package name for installing a tgz of scoped packages. (@Timer)
- #1695 Add diagnostic code. (@tgig)
- #1675 Fix project cleanup on Windows. (@johann-sonntagbauer)
- #1662 Add project name validation. (@johann-sonntagbauer)
- #1669 Fix react dependency versions during initial install. (@johann-sonntagbauer)
💅 Enhancement
react-dev-utils
,react-scripts
react-dev-utils
,react-error-overlay
react-scripts
- #2187 Ignore Moment.js locales by default. (@gaearon)
- #1771 Adding plugin postcss-flexbugs-fixes and flexbox: 'no-2009' to Autoprefixer. (@cr101)
- #1614 Upgrade to Jest
19(now 20). (@rogeliog) - #1993 Removed redundant UglifyJS options. (@marcofugaro)
- #1800 Suggest
yarn build
instead ofyarn run build
. (@geoffdavis92) - #1760 Suggest
serve
for running in production. (@leo) - #1747 Display
yarn
instead ofyarnpkg
when creating a new application. (@lpalmes) - #1433 Modularise scripts. (@djgrant)
- #1677 Add
X-FORWARDED
headers for proxy requests. (@johann-sonntagbauer)
eslint-config-react-app
,react-dev-utils
react-error-overlay
,react-scripts
babel-preset-react-app
,eslint-config-react-app
,react-dev-utils
,react-error-overlay
,react-scripts
eslint-config-react-app
- #2064 Removing a stylistic lint rule. (@anilreddykatta)
- #1763 disable ignoring unused vars prefixed with _. (@doshisid)
- #1989 Relax label rules (Closes #1835). (@anilreddykatta)
- #1773 Remove 'guard-for-in' lint rule. (@spicyj)
eslint-config-react-app
,react-scripts
react-dev-utils
create-react-app
- #1811 Allow creation of apps in empty Mercurial repos. (@GreenGremlin)
- Other
📝 Documentation
react-scripts
- #2193 Fix webpack config typo. (@Justkant)
- #2137 Remove live-editing since isn't accurate. (@cesarvarela)
- #2114 Update Sass README. (@kellyrmilligan)
- #2081 Fixed link for storybook. (@scottrangerio)
- #2052 Fix instructions for serving with now. (@davidascher)
- #2058 Clarify
.eslintrc
effects. (@luftywiranda13) - #2054 Suggest to create
.eslintrc
for IDE lint plugins. (@gaearon) - #2033 Fix Netlify heading level. (@benpickles)
- #1987 Suggest
node-sass
alternative. (@michaelwayman) - #1988 Update doc server example to work from any directory. (@isramos)
- #1982 Update information in User Guide for Enzyme dependency. (@josephrace)
- #1911 Suggest Yarn in HTML template. (@tmos)
- #1869 User Guide: Removed blockquote from code section, due to markdown conflict. (@stochris)
- #1756 Add Yarn steps for adding flow. (@zertosh)
- #1710 Update now.sh deployment instructions. (@replaid)
- #1717 Add docs for apache's client side routing setting. (@viankakrisna)
- #1698 Suggest to use
.env
for enabling polling mode. (@gaearon) - #1687 Fixed missing --recursive flag in first
npm run watch-css
command. (@mklemme) - #1657 Set Chrome userDataDir to be under .vscode folder. (@ryansully)
- Other
- #2135 Add note about
yarn.lock
. (@viankakrisna) - #2040 Fix typo. (@tijwelch)
- #1991 Add folder structure docs for new contributors. (@anilreddykatta)
- #1962 Add sku to the list of alternatives. (@markdalgleish)
- #1799 Improve phrasing. (@moniuch)
- #2135 Add note about
babel-preset-react-app
- #1787 Update side-effect documentation. (@evenchange4)
🏠 Internal
react-scripts
- #2213 Use some ES6 syntax. (@shashkovdanil)
- #1913 Add linked modules test. (@Timer)
- #1736 Fix eject for linked react-scripts. (@tuchk4)
- #1741 Fix internal linting setup. (@gaearon)
- #1730 Fix Node 4 e2e tests. (@Timer)
- #1715 Remove unused
url
import in Webpack config. (@pd4d10) - #1700 Update extract-text-webpack-plugin to stable. (@SimenB)
react-dev-utils
,react-scripts
babel-preset-react-app
,react-scripts
create-react-app
,react-dev-utils
,react-scripts
- #1897 Bump minimal Node version to 6. (@ianschmitz)
- Other
- #1868 Fix AppVeyor CI. (@darrenscerri)
- #1825 Added test to check for accidental extraneous dependencies. (@lpalmes)
- #1876 Fix AppVeyor CI. (@darrenscerri)
- #1723 Skip AppVeyor CI builds for Markdown changes. (@gaearon)
- #1707 Add double quotes to escape spaces in paths in e2e. (@viankakrisna)
- #1688 Pin and upgrade lerna version. (@viankakrisna)
- #1648 Add
appveyor.yml
. (@Timer)
babel-preset-react-app
,create-react-app
,eslint-config-react-app
,react-dev-utils
,react-scripts
eslint-config-react-app
eslint-config-react-app
,react-dev-utils
,react-scripts
react-dev-utils
Committers: 66
- Ade Viankakrisna Fadlil (viankakrisna)
- Alison Monteiro (alisonmonteiro)
- Almero Steyn (AlmeroSteyn)
- Andrej Badin (Andreyco)
- Andres Suarez (zertosh)
- Asa Ayers (AsaAyers)
- Ben Alpert (spicyj)
- Ben Pickles (benpickles)
- Bond (bondz)
- Brian Vaughn (bvaughn)
- Buns Shar (bunshar)
- Cesar Varela (cesarvarela)
- Chris Drackett (chrisdrackett)
- Cristian Rosescu (cr101)
- Dan Abramov (gaearon)
- Daniel Grant (djgrant)
- Danil Shashkov (shashkovdanil)
- Darren Scerri (darrenscerri)
- David (dbismut)
- David Ascher (davidascher)
- Gabriel Aumala (GAumala)
- Geoff Davis (geoffdavis92)
- Ian Schmitz (ianschmitz)
- Ian Sutherland (iansu)
- Igor Ramos (isramos)
- James Blight (jamesblight)
- Jeffrey Posnick (jeffposnick)
- Jeremy Morrell (jmorrell)
- Jeremy Stucki (herrstucki)
- Joe Haddad (Timer)
- Johann Hubert Sonntagbauer (johann-sonntagbauer)
- Jonathan (GreenGremlin)
- Joseph Race (josephrace)
- Kant (Justkant)
- Kelly (kellyrmilligan)
- Kent C. Dodds (kentcdodds)
- Koen de Leijer (kdleijer)
- Leo Lamprecht (leo)
- Lorenzo Palmes (lpalmes)
- Lufty Wiranda (luftywiranda13)
- Marco Fugaro (marcofugaro)
- Mark Dalgleish (markdalgleish)
- Mato Ilic (matoilic)
- Maxim Kazantsev (mkazantsev)
- Michael Hsu (evenchange4)
- Michael Wayman (michaelwayman)
- Myk Klemme (mklemme)
- Pierre Bertet (bpierre)
- Rogelio Guzman (rogeliog)
- Rory Hunter (pugnascotia)
- Ryan Platte (replaid)
- Ryan Sullivan (ryansully)
- Scott Ranger (scottrangerio)
- Siddharth Doshi (doshisid)
- Simen Bekkhus (SimenB)
- Simon Vocella (voxsim)
- Stoicescu Cristi (stochris)
- Tim Welch (tijwelch)
- Tom Canac (tmos)
- Tom Dunlap (motevets)
- Travis Giggy (tgig)
- Valerii Sorokobatko (tuchk4)
- alberto (alberto)
- anraka (anilreddykatta)
- moniuch (moniuch)
- pd4d10 (pd4d10)