Jul*_*ies 12 html javascript module typescript
我收到此错误:
Syntax Error: ambiguous indirect export
在 Firefox 中。可惜谷歌搜不到任何东西……
<script type="module">
import {someFunctionINeed} from "./js/functions.js";
...
</script>
Run Code Online (Sandbox Code Playgroud)
export function someFunctionINeed(cname) { ... }
Run Code Online (Sandbox Code Playgroud)
tsconfig.json
:"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"watch": true,
"removeComments": true
}
Run Code Online (Sandbox Code Playgroud)
package.json
:"type": "module"
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
好的,我找到了解决方案:在以下位置设置这些属性很重要tsconfig.json
:
"module": "ESNext",
"target": "esnext",
Run Code Online (Sandbox Code Playgroud)
否则它不会按照我需要的方式“编译”来支持函数的导入/导出。
归档时间: |
|
查看次数: |
24286 次 |
最近记录: |