Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'ambiguous indirect export' error JavaScript/TypeScript

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

  • This is my import:
<script type="module">
    import {someFunctionINeed} from "./js/functions.js";
    ...
</script>
  • This is my export:
export function someFunctionINeed(cname) { ... }
  • compilerOptions 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?

like image 493
Julius Babies Avatar asked Mar 15 '26 23:03

Julius Babies


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.

like image 93
Julius Babies Avatar answered Mar 17 '26 16:03

Julius Babies



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!