Getting 'ambiguous indirect export' error in JavaScript/TypeScript

Viewed 60

I am getting this error: Syntax Error: ambiguous indirect export in Firefox. Sadly there is nothing to find at Google...

  • This is my import:
<script type="module">
    import {someFunctionINeed} from "./js/functions.js";
    ...
</script>
  • This is my export:
export function someFunctionINeed(cname) { ... }
  • a part from my tsconfig.json:
"compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "sourceMap": true,
    "watch": true,
    "removeComments": true
}
  • and something that's maybe relevant from the package.json:
"type": "module"

What did I miss?

1 Answers

Ok, I found the solution: It's important to set these properties in the tsconfig.json:

"module": "ESNext",
"target": "esnext",

Otherwise it doesn't "compile" the way I need it to support importing/exporting of functions.

Related