我正在尝试将 Handsontable 与 NuxtJS (VueJS) 和 HyperFormula 一起使用。 Handsontable 工作正常,但我无法导入 HyperFormula。
当我这样做时:
import { HyperFormula } from 'hyperformula';
我立即得到一个错误:
ERROR Cannot convert undefined or null to object at Function.values (<anonymous>) at TranslationPackage.checkErrors (node_modules\.pnpm\[email protected]\node_modules\hyperformula\es\i18n\TranslationPackage.js:91:30) at new TranslationPackage (node_modules\.pnpm\[email protected]\node_modules\hyperformula\es\i18n\TranslationPackage.js:20:10)
这些是我的版本:
"dependencies": {
"@handsontable/vue3": "^14.4.0",
"hyperformula": "^2.7.0",
"nuxt": "^3.12.2",
"vue": "^3.4.29"
}
我真的找不到我做错了什么...... 有人可以帮助我吗?
确保您已正确安装 hyperformula 软件包 你的项目。您可以尝试使用以下命令重新安装它 命令:
npm install hyperformula
如果您使用的是 Webpack 或 Vite 等模块捆绑器,请确保 它已正确配置以处理超级公式包。查看 如果需要任何特定的配置设置 超级方程式。
尝试使用默认导入语法导入 HyperFormula 命名进口数量:
import HyperFormula from 'hyperformula';
如果上述步骤未能解决问题,您可以尝试使用 动态导入异步加载 HyperFormula:
let HyperFormula;
async function loadHyperFormula() {
HyperFormula = await import('hyperformula');
}
// Call the loadHyperFormula function before using HyperFormula
await loadHyperFormula();