I don’t understand why select2 doesn’t connect?
-
Hello everyone!
Please tell me what I'm doing wrong.
I build the project with Gulp.
script.js
import $ from 'jquery'; import select2 from 'select2'; import Swiper, {Scrollbar, Mousewheel, Navigation} from 'swiper'; Swiper.use([Scrollbar, Mousewheel, Navigation]); window.onload = function () { $('.select2').select2(); });
Galp challenge:
module.exports = function script(cb) { return browserify({ entries: [ // 'src/scripts/select2.full.min.js', 'src/scripts/scripts.js' ], transform: [ babelify.configure({ presets: ['@babel/preset-env'] }), ], }) .bundle() .pipe(source('scripts.js')) .pipe(buffer()) .pipe(sourcemaps.init()) .pipe(concat('scripts.js')) // Конкатенируем в один файл .pipe(terser()) .pipe(sourcemaps.write()) .pipe(rename({suffix: '.min'})) .pipe(gulp.dest('build/js')); };
But after assembly, it gives an error that selec2 is not present ((
What the hell does he want?) There are always some problems with him))JavaScript Anonymous, Sep 29, 2019
0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!