bxb100 / bxb100.github.io

This is my blog
https://blog.tomcat.run
MIT License
0 stars 0 forks source link

流水账:给 blog 加上 aplayer #50

Open bxb100 opened 6 months ago

bxb100 commented 6 months ago

yarn add aplayer


import 'aplayer/dist/APlayer.min.css';
import APlayer from 'aplayer';

const ap = new APlayer(options);
[vite]: Rollup failed to resolve import "APlayer/dist/APlayer.min.css" from "~/home/runner/work/bxb100.github.io/bxb100.github.io/src/components/Player.tsx". 

失败: 主因错误的使用了 yarn 但是不知道为啥不行

src/components/Player.tsx:3:21 - error ts(7016): Could not find a declaration file for module 'aplayer'.

参看^1 添加 aplayer.d.ts 成功


期间设置了 build.rollupOptions.external build.rollupOptions.commonjsOptions 都无用(事后来看确实不是问题的主因),所以最后为啥用 npm 就行但是一开始 yarn 不行没弄懂