-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
UnhandledPromiseRejectionWarning: TypeError: match.loader.options.plugins is not a function #11777
Comments
dilanx/craco/issues/313 dilanx/craco#353 diff --git a/lib/features/webpack/style/postcss.js b/lib/features/webpack/style/postcss.js
index e77f534f5df4327e4f2d19261f3f75d915afa5a1..c16149d9c9534d98e524aaad15cc47f8c0d218af 100644
--- a/lib/features/webpack/style/postcss.js
+++ b/lib/features/webpack/style/postcss.js
@@ -51,7 +51,7 @@ function extendsPostcss(match, { plugins, env }) {
let craPlugins = [];
if (match.loader.options) {
- craPlugins = match.loader.options.plugins();
+ craPlugins = match.loader.options.postcssOptions.plugins;
}
postcssPlugins = craPlugins || [];
@@ -64,10 +64,12 @@ function extendsPostcss(match, { plugins, env }) {
}
if (match.loader.options) {
- match.loader.options.plugins = () => postcssPlugins;
+ match.loader.options.postcssOptions.plugins = postcssPlugins;
} else {
match.loader.options = {
- plugins: () => postcssPlugins
+ postcssOptions: {
+ plugins: postcssPlugins
+ }
};
}
} |
@jawadsh123 you should submit a PR to CRACO instead ;) If it's backward compatible, I could release it without waiting for full support of CRA 5. |
try to replace "postcss" with "postcssOptions" in craco config |
thanks guys |
Compiled with problems:X ERROR in ./node_modules/dotenv/lib/main.js 24:11-24 Module not found: Error: Can't resolve 'fs' in 'E:\react\ReChat\client\node_modules\dotenv\lib' ERROR in ./node_modules/dotenv/lib/main.js 26:13-28 Module not found: Error: Can't resolve 'path' in 'E:\react\ReChat\client\node_modules\dotenv\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. If you want to include a polyfill, you need to: ERROR in ./node_modules/dotenv/lib/main.js 28:11-24 Module not found: Error: Can't resolve 'os' in 'E:\react\ReChat\client\node_modules\dotenv\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. If you want to include a polyfill, you need to: ERROR in ./node_modules/stream-chat-react/dist/css/index.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/stream-chat-react/dist/css/index.css) Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): ERROR in ./src/App.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/App.css) Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): ERROR in ./src/tailwind.config.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/tailwind.config.css) Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): Still gettings these error after patching postcss in craco |
Webpack 5 and CRA v5 don't add fallbacks for nodejs modules any more, it's a breaking change - dotenv should not be added in the browser code related issues closed in dotenv repo |
i needed to use env variables that's the reason i added dotenv in frontend... |
really work for me |
- Updated to TailwindCSS 3.0 (WARNING: This is using own workarounds: 1-[Craco config changed](facebook/create-react-app#11777 (comment)) 2-manually installed babel-runtime
Thank you! That worked like a charm. First time using patch-package, it's great |
same issue |
Your error resloved? |
You also need to change in the Dependencies-> "postcss" to "postcssOptions" |
I didn't change anything to dependencies and it works for me, but yeah for others this can be a another useful option to solve this issue 👍 |
step 3 |
Just seems like it works! There is no |
this option maybe cannot exist in postcss, but this method worked for me to ignore this error |
Yes you ignored the entire postcss config, so you ignored the error message also. |
try to replace "postcss" with "postcssOptions" in craco config I had the same problem , this method works for me. really work for me |
Why do you say it is work for you? |
Replace |
You can now install the new craco version which can fix this issue |
I tried this out, but it didn't help. I opened an issue here. I tried to replace |
adding postcssOptions instead of postcss inside craco.config.js worked for me too. Thanks |
What solved it for me was to change postcss to postcssOptions in craco.config.js and install this package: npm install --save-dev postcss-loader postcss |
till today, still worked for me. thanks |
Thank you sir! Worked for me. |
I had this problem with an untouched project for about a year. I was able to solve it by the following steps. Step 1. Update postcss.js file with the following below.
Step 2. Change postcss to postcssOptions in craco.config.js file.
Step 3. Update your postcss version in your package.json file. I did this by removing the postcss version on my package.json then using npm i postcss.
Let me know if this works :) |
package.json
`{
}
`
craco.config.js
`module.exports = {
};`
I have just shifted to react scripts 5.0.0 for in order to get rid of this issue and now im getting an error in vs code console while doing npm start, which goes like UnhandledPromiseRejectionWarning: TypeError: match.loader.options.plugins is not a function and i don't know what is causing this error can someone please help out with this
The text was updated successfully, but these errors were encountered: