【发布时间】:2020-04-30 06:14:23
【问题描述】:
我尝试在浏览器(客户端)中将mathjs 作为模块导入。我在服务器上复制了this file,然后尝试导入js模块,但是总是失败。以下是我已经做过的一些试验:
import { mathjs } from "./math.min.js"
SyntaxError: 请求的模块 './../modules/math.min.js' 没有 提供一个名为“mathjs”的导出
import { math } from "./math.min.js"
SyntaxError: 请求的模块 './../modules/math.min.js' 没有 提供一个名为“math”的导出
import { create, all } from "./math.min.js"
语法错误:请求的模块“./math.min.js”未提供名为“all”的导出
我也试试:
import("/math.min.js");
Uncaught (in promise) TypeError: Cannot set property 'math' of undefined
注意路径没问题,我查过了。我可能遗漏了一些东西,但我找不到我做错了什么。欢迎任何帮助。
这是一个 repl.it 代码:https://repl.it/@FifiLulu/NewJollyRoutes
【问题讨论】:
标签: javascript module mathjs