Instantly share code, notes, and snippets.

@gaearon /2.x_alphas_to_2.0.md Secret
Last active Oct 10, 2018

Embed
What would you like to do?

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.

@marcinczenko

This comment has been minimized.

Show comment
Hide comment
@marcinczenko

marcinczenko Sep 27, 2018

I am so happy you decided to remove support for monorepos. We are using monorepos with react app in one of the workspaces and we were following all 2.0.0-next.xyz releases where we had to fork and continuously change one line in react-scripts that was specifically disabling treating other monorepo dependencies as source dependencies (and as a result react-scripts were doing linting on already transpiled modules). I realised that version 2.0.0-next.2150693d was the first that removed that functionality and I was really uncertain if it will make it to the official release... I am so glad it did.

marcinczenko commented Sep 27, 2018

I am so happy you decided to remove support for monorepos. We are using monorepos with react app in one of the workspaces and we were following all 2.0.0-next.xyz releases where we had to fork and continuously change one line in react-scripts that was specifically disabling treating other monorepo dependencies as source dependencies (and as a result react-scripts were doing linting on already transpiled modules). I realised that version 2.0.0-next.2150693d was the first that removed that functionality and I was really uncertain if it will make it to the official release... I am so glad it did.

@JacopKane

This comment has been minimized.

Show comment
Hide comment
@JacopKane

JacopKane Sep 27, 2018

thanks a lot! you have migration guide even from alpha!

JacopKane commented Sep 27, 2018

thanks a lot! you have migration guide even from alpha!

@JacopKane

This comment has been minimized.

Show comment
Hide comment
@JacopKane

JacopKane Sep 27, 2018

one thing I noticed is I didn't see .mjs extension in jest config (and maybe webpack either couldn't check that yet) but I guess it was there for a while ago?

JacopKane commented Sep 27, 2018

one thing I noticed is I didn't see .mjs extension in jest config (and maybe webpack either couldn't check that yet) but I guess it was there for a while ago?

@patroza

This comment has been minimized.

Show comment
Hide comment
@patroza

patroza Oct 1, 2018

@marcinzenko just because it had some rough edges which you seemed to bump into, it's not so cool to see this awesome feature go, especially when relying big projects on it. An improvement to resolve your issue would've been a lot better.

patroza commented Oct 1, 2018

@marcinzenko just because it had some rough edges which you seemed to bump into, it's not so cool to see this awesome feature go, especially when relying big projects on it. An improvement to resolve your issue would've been a lot better.

@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Oct 2, 2018

@patroza You're welcome to discuss how it should work in facebook/create-react-app#5161. We are very open to proposals, but this one just wasn't working well. We've made a decision not to ship it because fixing it without drastically rethinking it didn't appear possible. Again, if you know about a simple solution, you're welcome to propose it.

Owner

gaearon commented Oct 2, 2018

@patroza You're welcome to discuss how it should work in facebook/create-react-app#5161. We are very open to proposals, but this one just wasn't working well. We've made a decision not to ship it because fixing it without drastically rethinking it didn't appear possible. Again, if you know about a simple solution, you're welcome to propose it.

@kirill-konshin

This comment has been minimized.

Show comment
Hide comment
@kirill-konshin

kirill-konshin Oct 4, 2018

So sad you guys removed support for Monorepo. Basically this and SASS were the only desirable features of the 2.0 release.

The question now is if there is any 3.x alpha to switch on to have the previously implemented support?

kirill-konshin commented Oct 4, 2018

So sad you guys removed support for Monorepo. Basically this and SASS were the only desirable features of the 2.0 release.

The question now is if there is any 3.x alpha to switch on to have the previously implemented support?

@packetstracer

This comment has been minimized.

Show comment
Hide comment
@packetstracer

packetstracer Oct 10, 2018

So sad you guys removed support for Monorepo. Basically this and SASS were the only desirable features of the 2.0 release.

The question now is if there is any 3.x alpha to switch on to have the previously implemented support?

Same here as @kirill-konshin, our project development multi-team workflow and tools are based on yarn workspaces, we've already implemented this workflow in our customer and cannot go back now.

Are there any plans to include this in a future stable version? Will this take long?

Thanks.

packetstracer commented Oct 10, 2018

So sad you guys removed support for Monorepo. Basically this and SASS were the only desirable features of the 2.0 release.

The question now is if there is any 3.x alpha to switch on to have the previously implemented support?

Same here as @kirill-konshin, our project development multi-team workflow and tools are based on yarn workspaces, we've already implemented this workflow in our customer and cannot go back now.

Are there any plans to include this in a future stable version? Will this take long?

Thanks.

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