Vue-cli 载入 bootstrap 报错

2022-05-06 22:03:41 +08:00
 pcxys

jquery 已确认可用,

main.js 已导入

import ‘bootstrap/dist/css/bootstrap.min.css’,

import ‘bootstrap/dist/js/bootstrap.min’

保存,启动,载入 bootstrap 出现错误,求助。

ERROR Failed to compile with 1 errors 23:18:34

error in e:/github/project-manage-java/node_modules/_bootstrap@5.1.3@bootstrap/dist/js/bootstrap.min.js

Module parse failed: Unexpected token (6:12045) You may need an appropriate loader to handle this file type. | * Licensed under MIT ( https://github.com/twbs/bootstrap/blob/main/LICENSE) | */ | !function(t,e){“object”==typeof exports&&“undefined”!=typeof module?module.exports=e(require("@popperjs/core")):“function”==typeof define&&define.amd?define(["@popperjs/core"],e):(t=“undefined”!=typeof globalThis?globalThis:t||self).bootstrap=e(t.Popper)}(this,(function(t){“use strict”;function e(t){if(t&&t.__esModule)return t;const e=Object.create(null);if(t)for(const i in t)if(“default”!==i){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const i=e(t),s=“transitionend”,n=t=>{let e=t.getAttribute(“data-bs-target”);if(!e||"#"===e){let i=t.getAttribute(“href”);if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=#${i.split("#")[1]}),e=i&&"#"!==i?i.trim():null}return e},o=t=> …………已省略部分内容……………… {this._element.classList.remove(oi),$.trigger(this._element,“shown.bs.toast”),this._maybeScheduleHide()}),this._element,this._config.animation))}hide(){this._element.classList.contains(ni)&&($.trigger(this._element,“hide.bs.toast”).defaultPrevented||(this._element.classList.add(oi),this._queueCallback((()=>{this._element.classList.add(si),this._element.classList.remove(oi),this._element.classList.remove(ni),$.trigger(this._element,“hidden.bs.toast”)}),this._element,this._config.animation)))}dispose(){this._clearTimeout(),this._element.classList.contains(ni)&&this._element.classList.remove(ni),super.dispose()}_getConfig(t){return t={…ai,…X.getDataAttributes(this._element),…“object”==typeof t&&t?t:{}},h(ii,t,this.constructor.DefaultType),t}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e}if(e)return void this._clearTimeout();const i=t.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide()}_setListeners(){$.on(this._element,“mouseover.bs.toast”,(t=>this._onInteraction(t,!0))),$.on(this._element,“mouseout.bs.toast”,(t=>this._onInteraction(t,!1))),$.on(this._element,“focusin.bs.toast”,(t=>this._onInteraction(t,!0))),$.on(this._element,“focusout.bs.toast”,(t=>this._onInteraction(t,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){const e=li.getOrCreateInstance(this,t);if(“string”==typeof t){if(void 0===e[t])throw new TypeError(No method named "${t}");et}}))}}return F(li),v(li),{Alert:q,Button:U,Carousel:at,Collapse:mt,Dropdown:Ht,Modal:he,Offcanvas:me,Popover:Fe,ScrollSpy:Ye,Tab:ei,Toast:li,Tooltip:$e}})); | //# sourceMappingURL=bootstrap.min.js.map

@ ./src/main.js 8:0-44 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

740 次点击
所在节点    前端开发
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/851251

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX