繁体   English   中英

尽管在 Angular 中使用时,引导程序需要 popper.js

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM