jQuery is not defined when use fancybox and gulp

Guys, I don't understand how the build order of js scripts works at all There are plug-in scripts:

import $ from 'jquery'
import select2 from 'select2';
select2(window, $);

import FancyBox from '@fancyapps/fancybox';

import Swiper, {Scrollbar, Mousewheel, Navigation} from 'swiper';
Swiper.use([Scrollbar, Mousewheel, Navigation]);

And for some reason FancyBox connects before everyone else and because of this Swears that there is no jQuery why is this happening? how is it treated?

Error screen