Coggle requires JavaScript to display documents.
import
export
export function add(x: number, y: number) { return x + y; }
import { add } from "./utils.js"; console.log(add(1, 2));
utils
tsconfig.json
"module": "CommonJS"
Node
> 3
package.json
"type": "module",
"module": "ES6"
index.html
> open index.html
> Uncaught ReferenceError: exports is not defined at index.js:2:23
<!DOCTYPE html> <html lang="en"> <head> ... </head> <body> <script src="./dist/index.js"></script> </body> </html>
live-server
<!DOCTYPE html> <html lang="en"> <head> ... </head> <body> <script type="module" src="./dist/index.js"></script> </body> </html>