CairoMakie with Julia 1.8 on VScode

I was having the same issue in VSCode with Plots.jl and Julia 1.7.3. I got the following error

julia> VERSION
v"1.7.3"

julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
WARNING: could not import StaticArraysCore.FieldArray into StructArrays
ERROR: LoadError: UndefVarError: FieldArray not defined
...
ERROR: LoadError: Failed to precompile StructArrays [09ab397b-f2b6-538f-b94a-2f83cf4a842a] to C:\Users\prana\.julia\compiled\v1.7\StructArrays\jl_1CA4.tmp.
...
ERROR: LoadError: Failed to precompile GeometryBasics [5c1252a2-5f33-56bf-86c9-59e7332b4326] to C:\Users\prana\.julia\compiled\v1.7\GeometryBasics\jl_15AF.tmp.
...
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to C:\Users\prana\.julia\compiled\v1.7\Plots\jl_13E9.tmp.

However, if I use plots in a Julia REPL outside of VSCode I don’t get this error and everything works fine.
I have the following version of Plots.jl

  [91a5bcdd] Plots v1.31.7

I was able to resolve this using the process mentioned above by @wsshin

(@v1.7) pkg> rm Plots
# close and reopen VSCode
(@v1.7) pkg> add Plots
julia> using Plots