I think you need a combination of all ways.
Personally I think knowing the note names is essential because then you can teach yourself 3NPS Scales, Arpeggios In Position, 2NPS Arpeggios, Triads, Drop 2 Chord, Drop 3 Chords, Shell Voicings, etc.
I found the best way to learn the notes on the strings was playing on a single string, finding a specific note in all Strings as fast as you can (ex. Where are all the D notes), and saying the note names aloud when you are playing scales and arpeggios.
Then it is about memorizing these shapes, and that is when I think about things from a root note perspective and what intervals I’m playing. Most of these shapes are also symmetrical and repeat at the octave- Example being 2NPS Arpeggios- all exactly the same just repeating the Shape an octave higher.
Of course for this you have to know your theory- how scales and arpeggios, chords (and chord Voicings) are constructed, and what notes are in them.