maxmantz / redux-oidc

A package for managing OpenID Connect authentication in ReactJS / Redux apps
MIT License
400 stars 112 forks source link

npm run build failed to minify issue #109

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hello,

I am using redux-oidc in one of my projects and it was working perfectly until this week. Now, when I try to build the project, it gives me "Failed to minify" error.

`Creating an optimized production build... Failed to compile.

Failed to minify the code from this file:

    ./node_modules/redux-oidc/node_modules/oidc-client/src/Log.js:4`

The project is developed over the dotnet reactredux spa template. It doesn't use webpack. It uses react-scripts for build operation.

I tried to find the solution but there is nothing I can find. I really need some help.

Note: There is not even a single error if I try to run the project. But building the project is not working right now.

Thank you

maxmantz commented 6 years ago

This looks strange. The path node_modules/redux-oidc/node_modlues/oidc-client is wrong. oidc-client is a peer dependency of this library. Therefore it should be at the root of your node modules, as in node_modules/oidc-client (not a subdir of redux-oidc). Other than that, I'm afraid I can't help you. This seems to be an issue with the latest version of oidc-client (1.5.0). Maybe reverting back to a previous version, such as 1.4.1 of oidc-client can solve the issue temporarily until the current issue is fixed.

ghost commented 6 years ago

The error path was ./node_modules/oidc-client/src/Log.js:4 at first. Then I downgraded the oidc-client version to 1.4.0 in my package.json. Now the error shows this path. Actually I am confused too :)

redux-oidc version: 3.0.0-beta.17 oidc-version: 1.4.0

With this configurations, redux-oidc created a oidc-client subdir in it. I am not too new to react-redux but there might be something I did wrong. I am not an expert either.

maxmantz commented 6 years ago

I suppose something went wrong when you installed oidc-client@1.4.1. Maybe your command line was in the node_modules/redux-oidc directory when you ran npm install? My guess is that once the pathing issue is resolved, the other issue should be solved as well.

ghost commented 6 years ago

I am nearly sure there is not a problem with command line etc. I will try to resolve this problem. I will update this topic if I find any solution.

Thank you for your help.

ghost commented 6 years ago

Firstly, please don't get me wrong. I am not a developer who opens topics without doing any research about an error :) I was facing this issue for nearly a week and it was a little critical step for my project. Anyway, I resolved the problem, with the idea that you gave me.

This is a part of my package.json file. After this setup, build succeeded.

"dependencies": { // Other dependencies... "babel-polyfill": "^6.26.0", "oidc-client": "1.4.1",
"react-scripts": "1.1.0",
"redux-oidc": "^3.0.0-beta.17"
}, "scripts": { "start": "rimraf ./build && react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }

I am not sure, why redux-oidc had an subdir of oidc-client. But after deleting node_modules and installing them freshly with npm install the problem is gone.

Thanks @maxmantz . redux-oidc is a wonderful package. And you are really fast when it comes to helping people :)

Cheers

maxmantz commented 6 years ago

Happy to help. Glad you solved it.