【发布时间】:2020-10-27 22:22:39
【问题描述】:
在我的 app.js 上有
import $ from 'jquery';
global.$ = global.jQuery = $;
import 'chart.js/dist/Chart.min';
import 'chartjs-plugin-labels/build/chartjs-plugin-labels.min';
import 'bootstrap/js/dist/dropdown';
import '../../vendor/snapappointments/bootstrap-select/dist/js/bootstrap-select.min';
import 'ajax-bootstrap-select/dist/js/ajax-bootstrap-select.min';
import Lightpick from 'lightpick';
这是我的 webpack.confing-js
.setOutputPath('public/build/')
.setPublicPath('/build')
.enableVersioning()
.addEntry('app', './assets/js/app.js')
.splitEntryChunks()
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.autoProvidejQuery()
错误...无法正常工作。尝试了很多解决方案,但没有任何效果
ajax-bootstrap-select.min.js:21 Uncaught ReferenceError: jQuery is not defined
at Object../node_modules/ajax-bootstrap-select/dist/js/ajax-bootstrap-select.min.js (ajax-bootstrap-select.min.js:21)
【问题讨论】:
-
你试过 import * as $ from 'jquery' 吗?
-
不,这对我不起作用
标签: jquery symfony webpack-encore