-
Notifications
You must be signed in to change notification settings - Fork 428
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
2.0 Discussion #162
Comments
We should invest some time into tests. But it isn't blocks major release I suppose |
Would love to get some tests in place. If you have any proposal as far as best setup for that would be +1 |
We also can drop passing process.env.NODE_ENV as argument to rewires. |
As per my note here should make some adjustments for plugin ordering i.e. https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy#note-order-of-plugins-matters |
Okey lets get the party started, i have a pending PR, @timarney can you create a |
There's a branch now. |
react-scripts 2.0 is happening, more info here:
When CRA2 is out:
|
Is it critical to drop [email protected] support? |
Not critical but Id argue that there is no reason to upgrade rewire if you are holding of react-scripts. One of the new features in cra2 is css modules so naturally the less rewire should support it in rewire 2 but it will be a lot more job to add css module support to older versions because we only extend the config, not adding anything new. react-scripts 1.x => rewire 1.x , react-scripts 2 => rewire 2.x feels like a natural mapping which is easy for users to get. |
Would it be possible for you to publish a test version of react-app-rewired under @next in npm? |
@timarney now that there are changes that breaks rewire with cra2, can we have a pre release? I just pushed a minor tweak to next branch. |
Should be there now: next: 2.0.0 |
Thanks. I figured its better to hold of cleaning of supporting old webpack config formats untill webpack 4 is in cra2. |
After thinking about #204 for a while I think I'd like to see better utility for rule/loader list traversal and manipulation. What I'd like to be able to out of the box with utils provided by rewire v2 or earlier is:
|
Noting this for discussion
|
@timarney Hi! Apologies for hi-jacking the discussion, but today I tried using Requires Babel "^7.0.0-0", but was loaded with "6.26.0". If you are sure you have a compatible version of @babel/core, it is likely that something in your b
uild process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core"
to see what is calling Babel. Using regular EDIT: I can confirm that adding the Babel 7 bridge fixes the problem for me. ❯ yarn add @babel/core@^7.0.0-0 --dev
❯ yarn add [email protected] --dev Feels like this should not be necessary, though. |
@nfantone ... @andriijas might be able to shed some light but there really hasn't been any work done on the next version for a while and it's on the back burner for me for now. |
@nfantone you should be able to use react-app-rewire 1.x just fine with the cra 2.0 alpha. i also have a lot of other things going on right now and i think its easier to move forward with rewire 2 once cra 2 is more finalized. |
Need conversations search input box。 |
By the way, I made that thing I suggested in my previous comment into a separate package of its own: I think it can be useful outside of react-app-rewired too. For instance Next.js' webpack configuration is also meant to be customized in a similar way at runtime. Another one I can recall would be Storybook's "full control mode" and there are likely some other projects out there that suggest manipulating Webpack configuration at runtime It has not yet been covered with tests and also lacking documentation at the moment. So if you're going to use it, use it with caution, and either rely on intellisense of your code editor or take a look at the source code for the list of method names and their signatures. |
Some react version compatibility is missing. Not sure how that should be noted. Maybe also add some link to timarney#162 so people coming in with react or react-native apps that can't be rewired won't send in unwanted bug reports about things not working that are not supposed to be working.
Some react version compatibility is missing. Not sure how that should be noted. Maybe also add some link to timarney#162 so people coming in with react or react-native apps that can't be rewired won't send in unwanted bug reports about things not working that are not supposed to be working.
Note: If anyone has interest in leading / maintaining a 2.0 release @ me . My time has been and will be limited for this project. That is to say considering not doing 2.0 given I can't support it . Thanks to all for helping out to date. |
Thx for the update. Im currently not involved in any react project therefor not putting any time on the tools I worked on last spring. |
what a bummer, this project is a great idea |
OHHHH. Ahaha well I guess that was a waste of time. The README says "This repo doesn't support CRA 2.0", so I kind of assumed that it was broken. GitHub also didn't help by collapsing ~30 comments in the middle, so I didn't see anything about customize-cra. For some reason I thought GitHub only collapsed the "+1" and "me too" comments. I might just use your config then. Thanks! |
Sorry I just wanted to follow-up one last time and say that I actually really like craco to configure
I think my const CracoAntDesignPlugin = require('craco-antd');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const WebpackBar = require('webpackbar');
module.exports = {
webpack: {
alias: { react: 'preact-compat', 'react-dom': 'preact-compat' },
plugins: [
new BundleAnalyzerPlugin(),
new WebpackBar({ profile: true }),
],
},
plugins: [{ plugin: CracoAntDesignPlugin }],
}; Thanks @abenhamdine for the tip about |
That's great ! I like craco design too, but I failed to make less loader work last time I tried craco, thus I'm eager to try your plugins. |
Sorry for the noise, I just want to let know that craco and craco-antd plugin work perfectly with cra 2.1.1/antd/typescript so craco looks like a good alternative. In another hand, react-app-rewired is also still working fine for us with cra 2.1.1/antd/typescript (maybe some react-app-rewired-xxx plugins are breaking with cra 2.X but it didn't affect us). |
Hi guys, I have tried a different approach and followed the guidelines proposed in CRA to extend it by forking the https://github.com/marcopeg/create-react-app/blob/master/packages/react-scripts/README.md I'd love to hear some feedbacks and maybe get collaboration in porting few plugins into it. |
Hi, I have started a react app with CRA v2.0, this is how I have edited my scripts in "scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-scripts eject",
}, Now that I run
Is this really not working with CRA v2. ? Why ? Should we use |
@kopax |
Well, my issue was a wrong parameter of |
@kopax The core functions work with CRA2.x, but many (most?) of the pre-existing rewires do not, because they were written for Webpack 2/3, and the Webpack 4 configuration has altered significantly - many of those rewires break. The decision finally was that there should be a split to a new project for CRA2.x rather than continuing react-app-rewired so that old rewires that were no longer maintained and were not CRA2.x compatible were not mistakenly thought to be working. Two potential splits have emerged - one being craco and the other being customize-cra. Customize-cra uses the core functionality from react-app-rewired, but provides new rewires written for CRA2.x. Craco provides that functionality in a separate way without requiring react-app-rewired. |
@Timer just add API-hook, like GatsbyJS onCreateWebpackConfig. Please! I like CRA, but GatsbyJS leading. |
The things I've used rewired for is mostly getting decorators to work. It would also be nice to get to override some other things like eslint config. |
For anyone just manually overriding the config, this works 100% fine with CRA2, using it in production with many projects. |
i just updated to |
@jihchi |
One should know that https://github.com/sharegate/craco is now broken with cra 2.1.2, as this repo is, see dilanx/craco#61 |
That's a bummer. At least it was written for CRA V2, so it should at least be more likely that it is maintained and will be fixed sooner (fingers crossed)... |
Again, no need to switch. This repo continues to work perfectly for CRA 2.1.1 |
You're right, sorry, I read CRA 2.1.2 instead of 2.1.1, I edited my previous comment accordingly #162 (comment) This repo still works perfectly for us too until <= cra 2.1.1 |
Just a note-- as an alternative with CRA 2.0, I tried https://github.com/jpavon/react-scripts-ts and found that it works perfectly with this version of react-app-rewired and allows for an upgrade to Webpack 4. It also seems to compile projects much faster than CRA 2.0. I have no association with jpavon's project other than I tried it and liked it, YMMV. |
I've published a 2.0 version to fix issues with CRA v2.1.2 . Thanks @tiffon + others who helped out. Utility helper rewires have been removed. If you must rewire this should get things back to a working state. Not other updates are planned this was just a break fix situation. Also with that I'm going to close this issue. |
seems rescripts is working: |
Thanks @timarney! Myself and other others I work with are very reliant on this project so I’d be happy to contribute to keep it going. I rely solely on custom requiring in config overrides, I’ve become a bit of a surgeon in regards to tweaking the CRA build process :). Love this project, thanks for your hard work. |
You can use monkey-react-scripts It lets you mutate webpack config and change babel config for tests module.exports = function(webpackConfig, isDevelopment) {
// mutate webpackConfig
}; |
TLDR:
See Readme notes for alternatives to this repo:
Also see - #343 as of Create React App 2.1.2 (there's a breaking issue) versions prior not using the utility functions from this repo still worked.
Opening this to discuss work to be done in a 2.0 release.
One thing I would like thoughts on dropping support for older versions of Webpack.
i.e. this part of code
The text was updated successfully, but these errors were encountered: