tuna / mirror-web

Source code of the web interface of https://mirrors.tuna.tsinghua.edu.cn/
GNU General Public License v2.0
759 stars 294 forks source link

TypeError: Ar.BootStrapModal is not a constructor #434

Closed Crystal-RainSlide closed 2 months ago

Crystal-RainSlide commented 2 months ago

Log:

TypeError: Ar.BootStrapModal is not a constructor
    onReady https://mirrors.tuna.tsinghua.edu.cn/assets/app-rtGvfbQ8.js:37
    Me https://mirrors.tuna.tsinghua.edu.cn/assets/mirrorList-B7O2nVj9.js:13
    fe https://mirrors.tuna.tsinghua.edu.cn/assets/mirrorList-B7O2nVj9.js:13
    wi https://mirrors.tuna.tsinghua.edu.cn/assets/mirrorList-B7O2nVj9.js:13
    setup https://mirrors.tuna.tsinghua.edu.cn/assets/app-rtGvfbQ8.js:1

Ar.BootStrapModal is undefined.

Code:

https://github.com/tuna/mirror-web/blob/ea51e0175199bab1fa12ceb106fdd41cc333e797/_src/entrypoints/app.ts#L18

Bootstrap 5 supports tree shaking and thus changed all the import names. It shall be (ref):

import { Modal } from "bootstrap/js/dist/modal";
// ...
      new Modal(isoModalEl).show();
shankerwangmiao commented 2 months ago

Many thanks for reporting this error.