U
U
uzi_no_uzi2019-09-10 23:31:21
JavaScript
uzi_no_uzi, 2019-09-10 23:31:21

Why does it throw an error $ is not defined?

I connect jquery to my project, as well as a file with my scripts written in jquery

//Link libs

import './libs/svg4everybody/svg4everybody.min.js';
import './libs/jQuery 3.4.1/jquery-3.4.1.js'

//Link scripts

import './js/common.js';


The project is built using webpack4. I

checked the dist folder, the library is added to bundle.js (the file where all my scripts go)

But it gives an error in the console.

ReferenceError: $is not defined


Code from
common.js


$(document).ready(function() {
  alert(1)

  //Connect polyfill for SVG sprite
  svg4everybody();

  $('lang-change__block-change').click(function() {
    alert(1)
  })
})

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question