Uncaught TypeError: Alpine.plugin is not a function
Uncaught TypeError: Alpine.plugin is not a function
我在 app.js 文件中放入
import Alpine from 'alpinejs';
window.Alpine = Alpine
Alpine.start()
import collapse from '@alpinejs/collapse';
Alpine.plugin(collapse)
它在 laravel mixer 中编译成功没有错误,但在刷新页面后在浏览器控制台中将显示下一个错误
at Module../resources/js/app.js (app.js?id=0ad42e965c3fd374b790:4118)
at __webpack_require__ (app.js?id=0ad42e965c3fd374b790:21603)
at app.js?id=0ad42e965c3fd374b790:21756
at Function.__webpack_require__.O (app.js?id=0ad42e965c3fd374b790:21640)
at app.js?id=0ad42e965c3fd374b790:21758
at app.js?id=0ad42e965c3fd374b790:21760
./resources/js/app.js @ app.js?id=0ad42e965c3fd374b790:4118
__webpack_require__ @ app.js?id=0ad42e965c3fd374b790:21603
(anonymous) @ app.js?id=0ad42e965c3fd374b790:21756
__webpack_require__.O @ app.js?id=0ad42e965c3fd374b790:21640
(anonymous) @ app.js?id=0ad42e965c3fd374b790:21758
(anonymous) @ app.js?id=0ad42e965c3fd374b790:21760```
looking for help to solve this problem
我确实遇到了这个问题,但已被 npm update alpinejs
修复
将 alpine 核心更新到 3.4.2
我在 app.js 文件中放入
import Alpine from 'alpinejs';
window.Alpine = Alpine
Alpine.start()
import collapse from '@alpinejs/collapse';
Alpine.plugin(collapse)
它在 laravel mixer 中编译成功没有错误,但在刷新页面后在浏览器控制台中将显示下一个错误
at Module../resources/js/app.js (app.js?id=0ad42e965c3fd374b790:4118)
at __webpack_require__ (app.js?id=0ad42e965c3fd374b790:21603)
at app.js?id=0ad42e965c3fd374b790:21756
at Function.__webpack_require__.O (app.js?id=0ad42e965c3fd374b790:21640)
at app.js?id=0ad42e965c3fd374b790:21758
at app.js?id=0ad42e965c3fd374b790:21760
./resources/js/app.js @ app.js?id=0ad42e965c3fd374b790:4118
__webpack_require__ @ app.js?id=0ad42e965c3fd374b790:21603
(anonymous) @ app.js?id=0ad42e965c3fd374b790:21756
__webpack_require__.O @ app.js?id=0ad42e965c3fd374b790:21640
(anonymous) @ app.js?id=0ad42e965c3fd374b790:21758
(anonymous) @ app.js?id=0ad42e965c3fd374b790:21760```
looking for help to solve this problem
我确实遇到了这个问题,但已被 npm update alpinejs
将 alpine 核心更新到 3.4.2