Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gaearon
Last active January 11, 2019 15:13
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaearon/8650d1c70e436e5eff01f396dffc4114 to your computer and use it in GitHub Desktop.
Save gaearon/8650d1c70e436e5eff01f396dffc4114 to your computer and use it in GitHub Desktop.

Migrating from 2.0.0-next.xyz

IMPORTANT: Do NOT do this if you didn't use 2.x alphas of react-scripts.

Inside any created project that has not been ejected, run:

$ npm install --save --save-exact react-scripts@2.0.3
$ # or
$ yarn add --exact react-scripts@2.0.3

After running this command, follow the instructions for migrating from 1.1.15 to 2.0.3. Then proceed to the migration steps below.

Monorepo support (from 2.x alphas) was removed in final 2.0

Monorepo support was half-baked and didn't account for many cases, so we decided to remove it. We know this is frustrating for people relying on it, but it was blocking the release and we didn't really have a solution that would work well in longer term. This is something we still want to do in the future, but we don't have a comprehensive proposal for this yet.

We're sorry that there's no easy way to migrate this, but it can be done:

For Application Logic

Importing application code should just work, provided it does not contain any JSX.

For Components

Importing uncompiled components (any file that contains JSX) will not work. You will need to compile these packages using something like nwb. Be sure your package.json main and module keys point to the compiled code and not the source code.

.graphql support was removed

We removed explicit support for importing .graphql files in favor of a Babel Macro.

Install graphql.macro and migrate your existing .graphql imports to look like this:

import { loader as gqlLoader } from 'graphql.macro';
const query = gqlLoader('./query.graphql');

New suggested browser defaults

Remove the browserslist key from package.json and you will be prompted to accept the new defaults next time you run the development server or a build.

Anything missing?

This was a large release, and we might have missed something.

Please file an issue and we will try to help.

@bebbi
Copy link

bebbi commented Jan 11, 2019

For people interested in graphql:
evenchange4/graphql.macro#43
graphql.macro seems to be unmaintained, graphql support for only basic use-cases and lots of open PRs.
Maybe there's another 'official' recommendation?

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