1
parsley.js是我的項目依賴於jQuery的唯一依賴項,通過刪除未使用的jQuery模塊來降低包含jQuery的成本會很好。有沒有人能夠得到parsley.js與最小的自定義生成的jQuery工作?
我曾嘗試構建一個自定義版本,如jQuery GitHub repo以及online equivalent所述,但兩者都無法正確運行。
當試圖使用自定義生成我收到以下錯誤
import jQuery from './custom-jquery' // local version of custom build
import Parsley from 'parsleyjs'
Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_0__custom_jquery___default(...)(...).parsley is not a function(…)
直接從NPM使用jQuery按預期工作
import jQuery from 'jquery'
import Parsley from 'parsleyjs'