sd1337 / adminlte-2-react

49 stars 24 forks source link

"Super expression must..." issue when installed via "npm i adminlte-2-react" #9

Closed juanruben closed 5 years ago

juanruben commented 5 years ago

Hi.

I've just compiled and tested the full project by ejecting cra and making the changes in the webpack config file. But I'd really like to start a brand new project only installing this package via npm, but I am still getting the TypeError: Super expression must either be null or a function, not undefined when upload to production server

In this case, what should I do? I did not use create-react-app

Thanks in advance

jasonna2607 commented 5 years ago

Same error happened here

jasonna2607 commented 5 years ago

@juanruben do let me know if you've found any other good AdminLTE-React sources like this. Urgent in need of production as I've spent days coding my website based on this module

juanruben commented 5 years ago

@jasonna2607 I tested another implementation, but it has not been active in the last year and it is too basic. I really think this is the best one available, but has this dependencies issues. One option is to migrate your project to follow the structure in the examples: https://github.com/sd1337/adminlte-2-react-examples

jasonna2607 commented 5 years ago

@juanruben migrate? Mind explaining it further? I’m kinda new to this whole React thing. And I’m using .JS btw not .JSX

juanruben commented 5 years ago

My main interest was to check that the build worked correctly on the production server, and I managed to do it with the examples and changes in the webpack. This issue happen when installing the package alone. Therefore, if you use the example as a base, there you can add your components and should have no problems. You can rename your files extensions and should be the same

jasonna2607 commented 5 years ago

@juanruben ahh I see. Is the changes in the web pack necessary for it to run in production mode? Cause I encounter the same problem as you when I publish it to the remote server after running “npm run build”

juanruben commented 5 years ago

@jasonna2607 yes. As author reported, you need to eject create-react-app and edit the webpack.config.js file: https://github.com/sd1337/adminlte-2-react/issues/2 That's all to make it work

sd1337 commented 5 years ago

Hi, i was busy traveling for work. As @juanruben said, you need to eject CRA and adjust the webpack config. The issue is inside of react-dates and I try every update but it did not solve it for now. For a detailed description look into the other solved issue https://github.com/sd1337/adminlte-2-react/issues/2#issuecomment-476348358

juanruben commented 5 years ago

@sd1337 Have you noticed something about installing the package? If I do it in that way, what should be done to solve the same error as in the examples? I do not use create-react-app and created the project with parcel instead of webpack. So, do not have where to make the adjustments

sd1337 commented 5 years ago

I have no actual knowledge about parcel. But if it has an optimizier/minifier/uglifier it should help when you can disable some kind of option that removes unused functions. Thats what the "unused": false option in create-react-app webpack Terser Plugin does, is does keep any declared function even when they are never actually referenced (maybe they get invoked dynamically)

juanruben commented 5 years ago

Hi. I've just created again a clean project with CRA, and it actually works that way. Only wanted to use parcel because of its shorter and clearer config, but actually I have no problem dealing with webpack. Thanks @sd1337 for the clarifications. You have done a very good job with this package