locally with node v17.9.1 and in a just created docker container with node 16.7.0
npm init
add "type": "module" to package.json
create a a.js file with just import * as Belt from '@mobily/ts-belt'
node a.js
/tsbelt # node a.js
(node:63) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/tsbelt/node_modules/@mobily/ts-belt/dist/esm/index.js:1
import { pipe } from "./pipe.js";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:196:29)
at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
at async Loader.import (node:internal/modules/esm/loader:178:24)
at async Object.loadESM (node:internal/process/esm_loader:68:5)
Steps
npm init
"type": "module"
to package.jsona.js
file with justimport * as Belt from '@mobily/ts-belt'