-
Notifications
You must be signed in to change notification settings - Fork 423
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
react-app-rewire-less not working #67
Comments
react-app-rewire-less@2.0.5 |
I still have the problem with "react-app-rewire-less": "^2.1.0", |
@sunnyYanan Could you please post the output from adding the console.log line below to your config-overrides.js file just before the call to react-app-rewire-less: // Turns the regex tests defined in the rules into a human readable string instead of an empty object,
// so we can actually see the rule tests defined when we output it to the console.
function stringifyConfig(name, value) {
if (value && value.constructor === RegExp) {
return value.toString();
}
return value;
}
// Assuming you're using the single function type of config-overrides.js. If not, this should be the
// "webpack" function in the combined export.
module.exports = function(config, env) {
// Output the actual configuration rules as generated on your machine
console.log(`${JSON.stringify(config.module.rules, stringifyConfig, 2)}`);
// Just to exit out without going any further, so the log messages do not get wiped away.
throw new Error('stop here');
config = react-app-rewire-less(config, env);
...the rest of your changes here...
return config;
} Once you have the console output from above, you can undo these changes - they're just to put together what the actual rules are that are being passed to the rewire so that we can debug why the file-loader is not being found properly on your machine. And a quick question just to confirm - are you using the normal/default react-scripts package, or are you using a custom scripts package (the |
here is my output, and I use the default react-scripts package |
@sunnyYanan Looking at the above, the file-loader really should have been able to be found - we search for it as both react-app-rewired/packages/react-app-rewire-less/index.js Lines 8 to 11 in 6b3e04b
react-app-rewired/packages/react-app-rewired/index.js Lines 14 to 24 in 6b3e04b
react-app-rewired/packages/react-app-rewired/index.js Lines 4 to 8 in 6b3e04b
It should have gone past the first rule in the config.modules.rules, found the "oneOf" clause in the second rule, then iterated through each of the subrules in the oneOf clause until it found a match with the last subrule according to the config that you have posted. |
Having the same issue as @sunnyYanan. This is an active bug, please re-open. |
@pauliusuza @sunnyYanan Can either of you put together a sample repository that shows this happening? What OS are you seeing it on? At this stage, I cannot reproduce the issue, and the output that @sunnyYanan provided shows that it should not have been happening, so without a way to reproduce and with output that I can see no reason for the code to be failing I am at a loss to be able to help any further. The original reason for this to have been occurring was that we were looking for |
I meet this bug yet. react-app-rewire-less@2.1.0 this is my output: |
I find the problem... |
my quick fixconst path = require('path'); function excludeExtension(config, extension) {
} function rewireLess(config, env) {
} function rewriteSVG(config, env) {
} module.exports = compose(rewireLess, rewriteSVG); |
Reloading version 1.1.0 can solve this problem. |
The text was updated successfully, but these errors were encountered: