背景:
用 uniapp 只开发 h5 端,需要二维码生成和 pdf 预览功能,然后就去 npm 官网搜了 qrcode、pdf.js 库。安装完毕后,引入时就报解析错误了...
qrcode 引入报错内容如下:
09:36:18.271 X [ERROR] Could not resolve "dijkstrajs"
09:36:18.272 ../../../../Frontend/UniApp/rfx-vcard-uniapp/node_modules/qrcode/lib/core/segments.js:8:25:
09:36:18.272 8 │ const dijkstra = require('dijkstrajs')
09:36:18.272 ╵ ~~~~
09:36:18.272 You can mark the path "dijkstrajs" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
09:36:18.272 Build failed with 1 error:
09:36:18.273 ../../../../Frontend/UniApp/rfx-vcard-uniapp/node_modules/qrcode/lib/core/segments.js:8:25: ERROR: Could not resolve "dijkstrajs"
疑问:
用 uniapp 开发时,就算只开发某一端,是不是也得用 uniapp 适配过的库才行?
白開水 (作者)
还真是的 用npm安装不会报错了
2024-10-28 16:44