S
S
sasha_jarvi2020-05-06 14:37:49
JavaScript
sasha_jarvi, 2020-05-06 14:37:49

How to fix "Uncaught ReferenceError: jQuery is not defined" error when using admin-lte3?

I use webpack to build the front, at the entry point (index.js) I wrote the following:

import $ from 'jquery';
import popper from 'popper.js';
import bootstrap from 'bootstrap';
import 'admin-lte/dist/js/adminlte.min.js'


The project builds with no errors or warnings, but when the page loads, the console displays "Uncaught ReferenceError: jQuery is not defined" even though jQuery is included before adminlte.min.js.
bd9e02ffe8.jpg

How to fix this error?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Just Me, 2020-05-07
@sasha_jarvi

const webpack = require('webpack');

plugins: [
    new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery'
    })
  ],

A
Alexander Sharomet, 2020-05-06
@sharomet

import {$,jQuery} from 'jquery';
window.$ = $;
window.jQuery = jQuery;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question