[英]Bootstrap requires popper.js despite bundle when used in Angular
我通過npm
安裝了bootstrap@next
( v5.0.0-alpha1
)。 我將捆綁JS添加到腳本中,但編譯后收到此錯誤:
ERROR in ./node_modules/bootstrap/dist/js/bootstrap.esm.js
Module not found: Error: Can't resolve 'popper.js' in
'./foo/node_modules/bootstrap/dist/js'
自述文件明確指出(粗體文本):
我們提供編譯后的 CSS 和 JS (bootstrap. ),以及編譯和縮小的 CSS 和 JS (bootstrap.min. )。 源映射 (bootstrap.*.map) 可用於某些瀏覽器的開發工具。 捆綁的 JS 文件(bootstrap.bundle.js 和縮小的 bootstrap.bundle.min.js)包括 Popper。
angular.json
"scripts": [
"node_modules/bootstrap/dist/js/bootstrap.bundle.js",
],
知道我在這里會錯過什么嗎?
只需在 package.json 中列出 popper 就足夠了。 我遇到了同樣的問題,刪除“node_modules/bootstrap/dist/js/bootstrap.bundle.js”后它對我有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.