Yes, in Nuxt3 everything is module, from server with node to frontend with
If we try to load a commonjs script it will be transpiled to esm first, this is made by vitejs: Dependency Pre-Bundling | Vite (vitejs.dev)
By default, node treat .js and .cjs files as commonjs and .mjs as modules.
If we set
"type": "module" in our package.json, it will treat .js as modules instead of commonjs for all files, breaking third party packages.
Setting “module” entrypoint to your package.json only point which file should be used when using import statement, but not force to be interpreted as module.
I’ve ended using this as import, but it looses all typescript declaration:
<script setup lang="ts">
import * as go from 'gojs/release/go.mjs'