javascript - 在浏览器中运行节点模块
问题描述
我正在尝试使用此节点模块上传和读取 excel 文件:read-excel-file并根据浏览器下的说明,我需要将此代码放入我的 .js 文件中:
import readXlsxFile from 'read-excel-file'
const input = document.getElementById('input')
input.addEventListener('change', () => {
readXlsxFile(input.files[0]).then((rows) => {
// `rows` is an array of rows
// each row being an array of cells.
})
})
但是浏览器不知道什么是import readXlsxFile from 'read-excel-file'
. 应该注意的是,我http-server
用来查看我的项目http://localhost:8080/
解决方案
推荐阅读
- visual-studio-code - 无法在 VS Code 中使用带有 Jupyter Notebook 扩展 v2021.6.999662501 的剪切、复制、粘贴功能
- outlook - 公司的 Microsoft Graph API 邮件服务
- android - 错误膨胀类 com.google.android.material.textfield.TextInputLayout 我已经尝试了所有我尝试更改依赖项但没有
- vba - Access - 从组合框中过滤连续表单文本字段
- loops - LOOP itab vs VALUE FOR 过滤,哪个更高效?
- c++ - std::deque、引用和“pop”
- angular - 具有原生 Web 组件和路由的 Angular 基础应用程序
- postgresql - 如何修剪特定文本
- php - 在 xamp 上运行时每个页面上的 Wordpress Electro 主题错误“尝试访问 bool 类型值的数组偏移量”
- python - 手动将 pytorch 权重转换为卷积层的 tf.keras 权重