我正在尝试在我的 shadow-cljs 项目中导入 wasm 包。它捆绑在一个 npm 包中,但我不断收到此错误:
The required JS dependency "canvas" is not available, it was required by "canvas/core.cljs".
这是我的项目结构:
. <- root of the rust crate
├── canvas
│ ├── env
│ ├── node_modules
│ │ ├── ...
│ │ ├── canvas -> ../../pkg <- my local package
│ │ └── ...
│ ├── resources
│ ├── src
│ └── target
├── pkg <- my local package
├── src
├── target
└── tests
这是我的 package.json (来自 clojurescript 项目):
{
"devDependencies": {
"shadow-cljs": "^2.8.83"
},
"dependencies": {
"canvas": "file:../pkg",
"create-react-class": "^15.6.3",
"react": "^16.4.0",
"react-dom": "^16.4.0"
}
}
我像这样(在 core.cljs 中)运行npm install
并将画布模块添加到我的项目中:
(ns canvas.core
(:require
...
["canvas" :as canvas]))
这里似乎有什么问题?