我正在将旧版 Web 应用程序转移到某种前端依赖管理器上运行。在本例中,我使用 Webpack 和 NPM。
我已经能够迁移应用程序的 90%,但是我遇到了 bootstrap-touch-carousel 的问题。 .
看来即使我已经通过 npm 安装了它,我仍然无法通过正常的 require(./bootstrap-touch-carousel) 调用它。
某些依赖项是否需要不同的要求?还是我走错了路?
最佳答案
您无法使用 require('bootstrap-touch-carousel')
导入它,因为在此模块中 package.json there isn't main file
您必须通过执行以下操作显式导入分布式 .js 文件:
require('bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel')
关于javascript - 带 Webpack 的 Bootstrap Touch Carousel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38305103/