我在使用 bootstrap5 和 NPM 时遇到一些问题。网站设计使用 bootstrap 并且可以工作,但不是所有的 js(下拉菜单、模态等...),我只是想学习如何在没有 CDN 的情况下导入 js bs 包。有人可以帮助我吗?谢谢你的时间
我的步骤:
npm install bootstrap@5.0.0-alpha1
npm install popper.js --save
npm intsall node-sass --save-d
Run Code Online (Sandbox Code Playgroud)
包.json:
{
"name": "xlf",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "./node_modules/.bin/webpack --watch",
"sass": "node-sass --watch src/scss -o dist/css --output-style nested"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bootstrap": "^5.0.0-alpha1",
"popper.js": "^1.16.1"
},
"devDependencies": {
"node-sass": "^5.0.0",
"webpack": "^5.26.0",
"webpack-cli": "^4.5.0"
} …Run Code Online (Sandbox Code Playgroud)