[英]Vue CLI and Bootstrap via Webpack
我正在嘗試使引導程序與Vue CLI一起使用。 我像這樣安裝了jQuery和Bootstrap:
npm install jquery bootstrap
然后像這樣配置webpack:
module.exports = {
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
tether: 'tether',
Tether: 'tether',
'window.Tether': 'tether',
Alert: "exports-loader?Alert!bootstrap/js/dist/alert",
Button: "exports-loader?Button!bootstrap/js/dist/button",
Carousel: "exports-loader?Carousel!bootstrap/js/dist/carousel",
Collapse: "exports-loader?Collapse!bootstrap/js/dist/collapse",
Dropdown: "exports-loader?Dropdown!bootstrap/js/dist/dropdown",
Modal: "exports-loader?Modal!bootstrap/js/dist/modal",
Popover: "exports-loader?Popover!bootstrap/js/dist/popover",
Scrollspy: "exports-loader?Scrollspy!bootstrap/js/dist/scrollspy",
Tab: "exports-loader?Tab!bootstrap/js/dist/tab",
Tooltip: "exports-loader?Tooltip!bootstrap/js/dist/tooltip",
Util: "exports-loader?Util!bootstrap/js/dist/util",
})
],
}
雖然沒有喜悅。 即使使用jQuery。
我正在尋找一個webpack解決方案。
謝謝傑米
在main.js
或app.js
,無論您將哪個用作主要Javascript文件,都添加以下內容:
import 'bootstrap'
window.$ = window.jQuery = require('jquery')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.