SAFE-Stack / SAFE-template

dotnet CLI template for SAFE project
MIT License
282 stars 87 forks source link

Upgrade webpack and npm deps #485

Closed teknikal-wizard closed 2 years ago

teknikal-wizard commented 2 years ago

This updates all three webpack files (standard, test and minimal) to Webpack 5 format. It updates the npm dependencies to match. I also found that I had to pass the config explicitly to the fable command in the Run target.

Note - when testing I found that the tests are currently broken due to #465. I have submitted a fix for this as a separate PR, #484

isaacabraham commented 2 years ago

Closes #472

isaacabraham commented 2 years ago

cc: @dzoukr would you be able to have a look at this config given your recent work?

teknikal-wizard commented 2 years ago

Fwiw I took the SAFEr template as my guide so should look pretty familiar.

I think we might be able to remove the hot: true from the devServer options as I spotted a hint saying it is the default anyway.

The only thing that stumped me for a few minutes was that the webpack config was no longer picked up automatically, but if I passed it in in the same way we do to for the tests then it worked fine.

teknikal-wizard commented 2 years ago

Also, I did spot npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it! in the Travis build error, so I guess that the CI machine might need an npm update?

Dzoukr commented 2 years ago

cc: @Dzoukr would you be able to have a look at this config given your recent work?

Looks good to me, but be aware that I am far from being good at this. I rather randomly change things and see if it works 😄

teknikal-wizard commented 2 years ago

Hi @theimowski, earlier today @isaacabraham asked me to see if you could take a look at the failing pipelines here? As I mention above, perhaps the Travis machine needs an npm update? If there is anything I can do to help just shout :) Cheers!

theimowski commented 2 years ago

The Azure Pipelines seem to be failing due to different wording in new version of webpack. The tests look for a specified phrase in stdout which seems to be now webpack 5.64.2 compiled successfully in 2469 ms instead of ... : Compiled successfully. ... Not sure yet about Travis failures, but could be as you say - due to incompatible node / npm versions - you can try fiddling with these lines

teknikal-wizard commented 2 years ago

Just updated the stdOut phrase in the tests so hopefully that will sort Devops out. Also just found this thread which suggests the Travis failure is a node issue as I thought, so I will see if I can get that updated too.

teknikal-wizard commented 2 years ago

Node version seems update seemed to work, now both pipelines are failing on webpack being passed an unrecognised '-p' option. I'll see if I can fix that too.

teknikal-wizard commented 2 years ago

Ok @isaacabraham, all checks seem to be passing now