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

Bootstrap not working with react-scripts ^2.1.3 #5

Open
andre-engelbrecht opened this issue Feb 21, 2019 · 15 comments
Open

Bootstrap not working with react-scripts ^2.1.3 #5

andre-engelbrecht opened this issue Feb 21, 2019 · 15 comments

Comments

@andre-engelbrecht
Copy link

Hi, I'm unable to run the bootstrap command when using react-script 2.1.3 or higher.
This is because since v2.1.3 (or somewhere around there) the webpack.config scripts changed. There are no longer dev an prod config files and this makes the bootstrap command fail with:

ENOENT: no such file or directory, stat '...\monorepo-react\packages\react-app\node_modules\react-scripts\config\webpack.config.dev.js'

The following two config scripts now exist:

  • env.js
  • paths.js
  • webpack.config.js
  • webpackDEvServer.config.js

I know there was already a previous issue created for this very same issue, but it was closed without any real resolution: #4
Their solution was to roll-back to v2.0.5 (of react-scripts). I might do this as a temporary solution, but what are the odds you could update your utility to also support the new react-scripts configuration?

BTW, I think this utility is absolutely awesome, and I've not seen something similar yet. I really want HMR with my shared components, manually building them each time sucks.

@kjgraham
Copy link

i was able to get this issue to go away by manually creating a webpack.config.dev.js and webpack.config.prod.js (just did a [save as] on webpack.config.js).

However, although the script ran successfully, it still won't bypass the Module not found: Can't resolve '@my-project/comp-button' error message you see when you run the react app

@F1LT3R
Copy link
Owner

F1LT3R commented Feb 21, 2019

@andre-engelbrecht
Copy link
Author

andre-engelbrecht commented Feb 22, 2019

i was able to get this issue to go away by manually creating a webpack.config.dev.js and webpack.config.prod.js (just did a [save as] on webpack.config.js).

However, although the script ran successfully, it still won't bypass the Module not found: Can't resolve '@my-project/comp-button' error message you see when you run the react app

@kjgraham, I can help with that. There are a few tiny typos in the guide (https://f1lt3r.io/guide-multi-react-app-monorepo-with/)

Notice that in the package.json of comp-button the name (namespace) is setup as:
"name": "@project/comp-button"

But then in the package.json from my-react-app the reference is setup as:
"**@my-**project/comp-button": "*"

Notice the difference @project/... vs @my-project/...

And then also make sure your import is correct, not containing 'my-':
import CompButton from '@**my-**project/comp-button';

@andre-engelbrecht
Copy link
Author

https://github.com/F1LT3R/cra-workspaces-poc

@F1LT3R , thanks for the link, I will definitely try that out.

But I'm still wondering though, is there no way to tackle this problem in a way that would allow using the latest version(s) of CRA along with older versions, up to a specified version perhaps?

I really like what you did with the babel-loader-lerna-cra package, if there were only a way to make it work with newer versions of CRA as well (after they changed the config files around).

P.S. I'm actually not concerned with older versions of CRA, but people generally value backwards compatibility, so that's why I mentioned it. But support for older versions is not a requirement from my side.

I'd love to know your thoughts on this?

Best regards,
@andre-engelbrecht

@F1LT3R
Copy link
Owner

F1LT3R commented Feb 22, 2019 via email

@andre-engelbrecht
Copy link
Author

@F1LT3R , I hear you, and no, there's no reason why I can't use your POC, It'll do the job just fine.
I'm just nitpicky about not using the latest versions of things when I can. I'm not sure what changed from react-scripts v2.1.1 to v2.1.5, and I'm afraid of missing out on some important updates.

@F1LT3R
Copy link
Owner

F1LT3R commented Feb 22, 2019

If you can convince me why you need 2.1.5, I'll upgrade @f1lt3r/react-scripts.

@andre-engelbrecht
Copy link
Author

@F1LT3R , I don't know if I can convince you to upgrade to 2.1.5, but I can see that 2.1.4 did include quite a number of tiny improvements: https://github.com/facebook/create-react-app/blob/master/CHANGELOG.md#214-february-10-2019

In the meantime I did find that you already have a version that's built on 2.1.3: https://www.npmjs.com/package/@f1lt3r/react-scripts. This is already better than 2.1.1.

Perhaps the sheer number of improvements in 2.1.4 could persuade you to upgrade, but while you're at it, rather just skip 2.1.4 and go straight to the latest version.

Anyway, I'm actually fine with using 2.1.3 for now, but it would be awesome if you'd consider upgrading to 2.1.5 eventually.

Best regards,
André

@andre-engelbrecht
Copy link
Author

So @F1LT3R, with the latest version of @f1lt3r/react-scripts - 2.1.3-e, how did you resolve this issue: facebook/create-react-app#6214, or is this still an issue?

If I revert to v2.1.1-workspaces-04 all is fine.

Apologies, I could not find a repo for @f1lt3r/react-scripts, and I though it perhaps better to not create a new issue for a closely related issue.

@d11ln
Copy link

d11ln commented Feb 22, 2019

https://github.com/F1LT3R/cra-workspaces-poc

@F1LT3R this is awesome, thanks for this, it's going to save me a ton of time.

I'd like to add some weight to the request for an upgrade to include 2.1.5. I personally prefer using 2.1.5 for it's improvement allowing jest type ahead support and would be hard pressed to have to roll back.

Any chance you'd be willing to reconsider upgrading? I get that you might not need to for your own purposes but I think a lot of us are holding thumbs that you do.

Thanks for what you've offered thus far though, this utility is fantastic.

@F1LT3R
Copy link
Owner

F1LT3R commented Feb 22, 2019

@andre-engelbrecht I didn't. I'm using the old version Workspaces-004 whatever.

I was waiting until they released their new version before finishing the upgrade.

I'll try to get to it next week. Big crunch at work right now.

@F1LT3R
Copy link
Owner

F1LT3R commented Feb 22, 2019

@dcugh glad you find it useful.

What are you asking me to consider upgrading?

The custom react scripts that works with the POC? Or babel-lerna-loader-cra ?

@andre-engelbrecht
Copy link
Author

Excellent, thanks @F1LT3R

@uxxman
Copy link

uxxman commented Jun 24, 2019

Any plan for upgrading it to v2@latest or v3?

@tmaziere
Copy link

Hi @F1LT3R,

It looks like we should now use react-workspaces-playground if we need CRA3, right?

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

No branches or pull requests

6 participants